Not to mention the following aberrations:

>>> {x for x in [float('nan')] * 10}
{nan}
>>> {float(x) for x in ['nan'] * 10}
{nan, nan, nan, nan, nan, nan, nan, nan, nan, nan}

>>> {float('nan')} | {float('nan')}
{nan, nan}
>>> {float('nan')} & {float('nan')}
set()



On Wed, Mar 24, 2010 at 6:36 PM, Alexander Belopolsky
<alexander.belopol...@gmail.com> wrote:
> On Wed, Mar 24, 2010 at 6:31 PM, Mark Dickinson <dicki...@gmail.com> wrote:
> ..
>> 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).
>
> No, it does not:
>
>>>> float('nan') in [float('nan')]
> False
>
>
> It would if NaNs were always interned, but they are not.
>
_______________________________________________
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