Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51940 > unrolled thread

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

Started byMarkus Rother <python@markusrother.de>
First post2013-08-05 00:35 +0200
Last post2013-08-05 00:35 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Bug? ( () == [] ) != ( ().__eq__([]) ) Markus Rother <python@markusrother.de> - 2013-08-05 00:35 +0200

#51940 — Bug? ( () == [] ) != ( ().__eq__([]) )

FromMarkus Rother <python@markusrother.de>
Date2013-08-05 00:35 +0200
SubjectBug? ( () == [] ) != ( ().__eq__([]) )
Message-ID<mailman.192.1375656719.1251.python-list@python.org>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web