[Python-ideas] checking for identity before comparing built-in objects
Guido van Rossum
guido at python.org
Tue Oct 9 08:58:55 CEST 2012
On Mon, Oct 8, 2012 at 11:49 PM, Mark Dickinson <dickinsm at gmail.com> wrote:
> 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.
Yeah, sorry, I misremembered. :-) This does mean we need to update the
text Ned is proposing.
--
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas
mailing list