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

Guido van Rossum guido at python.org
Mon Oct 8 22:47:53 CEST 2012

On Mon, Oct 8, 2012 at 1:39 PM, Ned Batchelder <ned at nedbatchelder.com> wrote:
> On 10/8/2012 12:25 PM, Guido van Rossum wrote:
>> Anyway, once we can agree to words I agree that we should update that
>> section.
> How about:
> "In accordance with the IEEE 754 standard, when NaNs are compared to any
> value, even another NaN, the result is always False, regardless of the
> comparison.  This is because NaN represents an unknown result.  There is no
> way to know the relationship between an unknown result and any other result,
> especially another unknown one.  Even comparing a NaN to itself always
> produces False."

Sounds good. (But now maybe we also need to come clean with the
exceptions for NaNs compared as part of container comparisons?)

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

More information about the Python-ideas mailing list