[Python-Dev] PyObject_RichCompareBool identity shortcut

Guido van Rossum guido at python.org
Thu Apr 28 05:16:45 CEST 2011


On Wed, Apr 27, 2011 at 11:48 AM, Robert Kern <robert.kern at gmail.com> wrote:
> On 4/27/11 12:44 PM, Terry Reedy wrote:
>>
>> On 4/27/2011 10:53 AM, Guido van Rossum wrote:
>
>>> Maybe we should just call off the odd NaN comparison behavior?
>>
>> Eiffel seems to have survived, though I do not know if it used for
>> numerical
>> work. I wonder how much code would break and what the scipy folks would
>> think.
>
> I suspect most of us would oppose changing it on general
> backwards-compatibility grounds rather than actually *liking* the current
> behavior. If the behavior changed with Python floats, we'd have to mull over
> whether we try to match that behavior with our scalar types (one of which
> subclasses from float) and our arrays. We would be either incompatible with
> Python or C, and we'd probably end up choosing Python to diverge from. It
> would make a mess, honestly. We already have to explain why equality is
> funky for arrays (arr1 == arr2 is a rich comparison that gives an array, not
> a bool, so we can't do containment tests for lists of arrays), so NaN is
> pretty easy to explain afterward.

So does NumPy also follow Python's behavior about ignoring the NaN
special-casing when doing array ops?

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


More information about the Python-Dev mailing list