Rich Comparisons Gotcha
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sun Dec 7 18:20:12 EST 2008
On Sun, 07 Dec 2008 15:32:53 -0600, Robert Kern wrote:
> Rasmus Fogh wrote:
>
>> Current behaviour is both inconsistent and counterintuitive, as these
>> examples show.
>>
>>>>> x = float('NaN')
>>>>> x == x
>> False
>
> Blame IEEE for that one. Rich comparisons have nothing to do with that
> one.
There is nothing to blame them for. This is the correct behaviour. NaNs
should *not* compare equal to themselves, that's mathematically
incoherent.
--
Steven
More information about the Python-list
mailing list