object identity and equivalence

Sandy Norton sandskyfly at hotmail.com
Mon Nov 19 19:44:16 CET 2001

Erno Kuusela wrote:

>> as a rule, a is b implies a == b (except for odd things like floating
>> point NaNs that compare inequal to themselves).
>> a == b does not imply a is b.

You are correct of course :

>>> x = 10.0
>>> y = 10.0
>>> x is y
>>> x == y

Two different objects, same value, different identity. Makes sense... must
have been a momentary lapse: I think I better change my coffee... (-:

Almost immediately after I posted my question, I ran another search and
found this link to be helpful:


> There! I've announced my ignorance to the world. Feel better already!
>> congratulations :)



More information about the Python-list mailing list