Mark Dickinson added the comment:
>>> float('nan') == float('nan')
False
>>> float('nan') != float('nan')
True
This is deliberate, though perhaps surprising if you haven't seen it before.
There's a long history of nan comparisons behaving this way (that is, x == nan
always returns False, x !
New submission from Jean-Michel Fauth :
I did not find any report about this.
Windows 7, Python 2.6.4
>>> float('inf') == float('inf')
True
>>> float('-inf') == float('-inf')
True
>>> float('-inf') == float('inf')
False
>>> float('-inf') != float('inf')
True
>>> float('nan') == float('nan')
Fal