Assertions

Thomas Jollans tjol at tjol.eu
Fri Sep 22 09:07:07 EDT 2017


On 2017-09-22 14:43, Steve D'Aprano wrote:
> In the case of floating point NANs, they are unordered with respect to all
> numbers. So for any number x, we always have:
> 
> NAN == x
> NAN < x
> NAN > x
> NAN <= x
> NAN >= x
> 
> all return False, and 
> 
> NAN != x
> 
> return True.

Just to make the implication explicit:

>>> from math import nan
>>> nan is nan
True
>>> nan == nan
False
>>> nan != nan
True
>>>


-- 
Thomas Jollans



More information about the Python-list mailing list