Why float('Nan') == float('Nan') is False

Marko Rauhamaa marko at pacujo.net
Wed Feb 13 15:32:18 EST 2019

"Avi Gross" <avigross at verizon.net>:

> A NaN is a bit like a black hole. Anything thrown in disappears and
> that is about all we know about it. No two black holes are the same
> even if they seem to have the same mass, spin and charge. All they
> share is that we don't know what is in them.

Then, how do you explain:

   >>> float("nan") != float("nan")

Why's that not False?


More information about the Python-list mailing list