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

Mark Dickinson dickinsm at gmail.com
Tue Oct 9 08:49:30 CEST 2012


On Tue, Oct 9, 2012 at 7:44 AM, Guido van Rossum <guido at python.org> wrote:
> This smells like a bug in the != operator, it seems to fall back to not ==
> which it didn't used to. More later.....

I'm fairly sure it's deliberate, and has been this way in Python for a
long time. IEEE 754 also has x != x when x is a NaN (at least, for
those IEEE 754 functions that return a boolean rather than signaling
an invalid exception), and it's a well documented property of NaNs
across languages.

-- 
Mark



More information about the Python-ideas mailing list