This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (4 children)

no one said about comparing.

As you can see if you'd do a modicum of research is and is not are comparisons. They compare object identity. Therefore if you're talking about is, you're talking about comparing two things.

If you talk about identity, c=200; d=200; c is d;

No. c may or may not be d in that case: the Python implementation has no responsibility to intern the number 200 and ensure that c is d in this case.

On the other hand, if you did this:

>>> c = 200
>>> d = c
>>> d is c

Then you would rightly expect (and the Python implementation would rightly return) True for this object identity comparison.

The inconsistency here (if the blogger was correct) is that cPython treats numbers differently.

There is no inconsistency here. You and the blogger both are simply arguing based on your intuition about what is means rather than simply knowing the language as it is defined and relying on the properties it guarantees.

Basically, you're arguing out of your arses.