Is nan in (nan,) correct?

Terry Reedy tjreedy at udel.edu
Thu Mar 5 20:20:23 EST 2015


Nothing about nans is 'correct'.  They are a CS invention

On 3/5/2015 5:26 PM, random832 at fastmail.us wrote:
> It's been brought up on Stack Overflow that the "in" operator (on
> tuples, and by my testing on dict and list, as well as dict lookup) uses
> object identity as a shortcut, and returns true immediately if the
> object being tested *is* an element of the container. However, the
> contains operation does not specify whether object identity or equality
> is to be used. In effect, the built-in container types use a hybrid
> test: "a is b or a == b".
>
> My question is, is this a *correct* implementation of the operator,

The current implementation of 'in' is 'correct' in that it reflects the 
intentions of GvR and other core developers.

-- 
Terry Jan Reedy




More information about the Python-list mailing list