"/a" is not "/a" ?
lie.1296 at gmail.com
Sat Mar 7 11:18:52 CET 2009
Steven D'Aprano wrote:
> Albert Hopkins wrote:
>> I would think (not having looked) that the implementation of == would
>> first check for identity (for performance reasons)...
> For some types, it may. I believe that string equality testing first tests
> whether the two strings are the same string, then tests if they have the
> same hash, and only then do a character-by-character comparison. Or so I've
> been told.
>> can an object be identical but not equal to itself?
> Yes. Floating point NANs are required to compare unequal to all floats,
> including themselves. It's part of the IEEE standard.
btw, have anybody noticed that the subject line "/a" is not "/a" is
>>> "/a" is not "/a"
>>> a = "/a"
>>> b = "/a"
>>> a is not b
More information about the Python-list