Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7740127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:41:44+00:00 2026-06-01T08:41:44+00:00

Why is () is () true, yet (0,) is (0,) is false? I thought

  • 0

Why is () is () true, yet (0,) is (0,) is false?

I thought they would be the same object. However, I’m apparently missing something.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:41:46+00:00Added an answer on June 1, 2026 at 8:41 am

    is tests to see if both sides of the statement share the same memory address. It’s basically a shorthand for id(a) == id(b)

    >>> print id(()), id(())
    30085168 30085168
    >>> print id((0,)), id((0,))
    38560624 38676432
    >>>
    

    As () happens fairly frequently, it is actually treated as a singleton by the Python Interpreter (just like integers from 0 to 255, empty strings, empty lists, etc.). When comparing (0, ) to (0, ) to the interpreter they are actually different variables in memory. If they were mutable, you could modify the first, and the second wouldn’t change, hence they are not the same (a is not b).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Android debuggable set to false, yet the condition true. What is wrong
TRUE/FALSE if clauses are easily and quickly done in R. However, if the argument
Experimenting with the conditional operator in ruby, def nada false ? true : nil
In Firefox this section of the code never seems to return true. Yet it
css3 pseudo class :disabled is this supported yet - thought it was but cannot
True or not: We should always use proper capitalization and never put whole sentences
while (true) { //read in the file StreamReader convert = new StreamReader(../../convert.txt); //define variables
if true && (function () { console.log('executed'); })() is ok, then why true &&
Is it true that the only way to handle default function arguments is through
Under Windows XP WPF true 3D content (which is usually displayed using the Viewport3D

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.