[Python-Dev] PyObject_RichCompareBool identity shortcut

Nick Coghlan ncoghlan at gmail.com
Thu Apr 28 05:43:58 CEST 2011


On Thu, Apr 28, 2011 at 12:42 PM, Stephen J. Turnbull
<stephen at xemacs.org> wrote:
> Mark Dickinson writes:
>
>  > Declaring that 'nan == nan' should be True seems attractive in
>  > theory,
>
> No, it's intuitively attractive, but that's because humans like nice
> continuous behavior.  In *theory*, it's true that some singularities
> are removable, and the NaN that occurs when evaluating at that point
> is actually definable in a broader context, but the point of NaN is
> that some singularities are *not* removable.  This is somewhat
> Pythonic: "In the presence of ambiguity, refuse to guess."

Refusing to guess in this case would be to treat all NaNs as
signalling NaNs, and that wouldn't be good, either :)

I like Terry's suggestion for a glossary entry, and have created an
updated proposal at http://bugs.python.org/issue11945

(I also noted that array.array is like collections.Sequence in failing
to enforce the container invariants in the presence of NaN values)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list