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

Guido van Rossum guido at python.org
Tue Oct 9 09:13:38 CEST 2012


Already retracted. :-(

On Tue, Oct 9, 2012 at 12:05 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Mon, Oct 08, 2012 at 11:44:12PM -0700, Guido van Rossum 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 pretty sure the behaviour is correct. When I get home this evening,
> I will check my copy of the Standard Apple Numerics manual (one of the
> first IEEE 754 compliant systems). In the meantime, I quote from
>
> "What Every Computer Scientist Should Know About Floating-Point
> Arithmetic"
>
> "Since comparing a NaN to a number with <, ≤, >, ≥, or = (but not ≠)
> always returns false..."
>
> (Admittedly it doesn't specifically state the case of comparing a NAN
> with a NAN.)
>
> http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
>
>
> --
> Steven
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas



-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list