[Python-Dev] PyObject_RichCompareBool identity shortcut

Hrvoje Niksic AVL HR hrvoje.niksic at avl.com
Thu Apr 28 10:23:15 CEST 2011


On 04/28/2011 04:31 AM, Stephen J. Turnbull wrote:
> Are you saying you would expect that
>
>>>>  nan = float('nan')
>>>>  a = [1, ..., 499, nan, 501, ..., 999]    # meta-ellipsis, not Ellipsis
>>>>  a == a
> False
>
> ??

I would expect l1 == l2, where l1 and l2 are both lists, to be 
semantically equivalent to len(l1) == len(l2) and all(imap(operator.eq, 
l1, l2)).  Currently it isn't, and that was the motivation for this thread.

If objects that break reflexivity of == are not allowed, this should be 
documented, and such objects banished from the standard library.

Hrvoje


More information about the Python-Dev mailing list