float('nan')==1 -> True

Pearu Peterson pearu at cens.ioc.ee
Sat Oct 19 12:41:18 EDT 2002


Hi,

I've noticed that

  float('nan')==float_obj

always returns True whatever is the value of float_obj in Python 1.5.2,
2.0.1, 2.1.3, 2.2.1.
I would have expected False for all float values because Undefined (that
should be the result of nan==float_obj) is closer to False than True,
IMHO.

I wonder what is the rationale behind this behaviour? Or is it a bug?

Pearu






More information about the Python-list mailing list