On Wed, Mar 24, 2010 at 10:30 PM, Alexander Belopolsky
<alexander.belopol...@gmail.com> wrote:
> On Wed, Mar 24, 2010 at 6:21 PM, Raymond Hettinger
> <raymond.hettin...@gmail.com> wrote:
> ..
>> If we want to be able to reason about our programs,
>> then we need to rely on equality relations being
>> reflexsive, symmetric, and transitive.  Otherwise,
>> containers and functions can't even make minimal
>> guarantees about what they do.
>
> +1
>
>> ..  We should probably draw the
>> line at well-defined numeric contexts such as the decimal module
>> and stop trying to propagate NaN awareness throughout the
>> entire object model.
>
> I am not sure what this means in practical terms.   Should
> float('nan') == float('nan') return True or should float('nan') raise
> an exception to begin with?   I would prefer the former.
>

Neither is necessary, because Python doesn't actually use == as the
equivalence relation for containment testing:  the actual equivalence
relation is:  x equivalent to y iff id(x) == id(y) or x == y.  This
restores the missing reflexivity (besides being a useful
optimization).

Mark
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to