Bug? ( () == [] ) != ( ().__eq__([]) )

Markus Rother python at markusrother.de
Sun Aug 4 18:35:58 EDT 2013


Hello,

The following behaviour seen in 3.2 seems very strange to me:

As expected:
 >>> () == []
False

However:
 >>> ().__eq__([])
NotImplemented
 >>> [].__eq__(())
NotImplemented

And:
 >>> bool(NotImplemented)
True

Hence:
 >>> bool(().__eq__([]))
True
 >>> ( () == [] ) != ( ().__eq__([]) )
True

How/why can this be intended?

Thanks, everybody.

Markus R.



More information about the Python-list mailing list