[issue4296] Python assumes identity implies equivalence; contradicts NaN

Christian Heimes report at bugs.python.org
Tue Nov 11 02:49:51 CET 2008


Christian Heimes <lists at cheimes.de> added the comment:

Interesting, Python 3.0 behaves differently than Python 2.x. Nice catch! :)

Python 3.0rc2 (r30rc2:67177, Nov 10 2008, 12:12:09)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> nan = float("nan")
>>> nan is nan
True
>>> nan == nan
False
>>> lst = [nan]
>>> lst is lst
True
>>> lst == lst
False

Python 2.6 (r26:66714, Oct  2 2008, 16:17:49)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> nan = float("nan")
>>> lst = [nan]
>>> lst == lst
True
>>> lst is lst
True

----------
nosy: +christian.heimes, marketdickinson
priority:  -> normal
stage:  -> test needed
versions: +Python 2.5, Python 2.6, Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4296>
_______________________________________


More information about the Python-bugs-list mailing list