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


Groups > comp.lang.python > #51940

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

Date 2013-08-05 00:35 +0200
From Markus Rother <python@markusrother.de>
Subject Bug? ( () == [] ) != ( ().__eq__([]) )
Newsgroups comp.lang.python
Message-ID <mailman.192.1375656719.1251.python-list@python.org> (permalink)

Show all headers | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web