[Python-ideas] checking for identity before comparing built-in objects

Ethan Furman ethan at stoneleaf.us
Tue Oct 9 17:54:03 CEST 2012

Steven D'Aprano wrote:
> 1) It is not the case that NaN <comp> NaN is always false.

Huh -- well, apparently NaN != Nan --> True.

However, borrowing Steven's earlier example, and modifying slightly:

sqr(-1) != sqr(-1)

Shouldn't this be False?

Or, to look at it another way, surely somewhere out in the Real World 
(tm) it is the case that two NaNs are indeed equal.


More information about the Python-ideas mailing list