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


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

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

Started byChris Angelico <rosuav@gmail.com>
First post2013-08-07 10:43 +0100
Last post2013-08-07 10:43 +0100
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Bug? ( () == [] ) != ( ().__eq__([]) ) Chris Angelico <rosuav@gmail.com> - 2013-08-07 10:43 +0100

#52126 — Re: Bug? ( () == [] ) != ( ().__eq__([]) )

FromChris Angelico <rosuav@gmail.com>
Date2013-08-07 10:43 +0100
SubjectRe: Bug? ( () == [] ) != ( ().__eq__([]) )
Message-ID<mailman.310.1375868597.1251.python-list@python.org>
On Wed, Aug 7, 2013 at 10:24 AM, Shiyao Ma <i@introo.me> wrote:
> Sorry. I don't quite get it. As you said, it first tries,
> leftOperand.__eq__(rightOperand) then if it returns NotImplemented, it goes
> to invoke rightOperand.__eq__(leftOperand). But for any reason, [] == ()
> returns false, why?

If neither of them has implemented a check, then it's assumed they're
not equal. It wouldn't be helpful for the == operator to return
anything other than True or False (except maybe NaN), so it returns
False.

ChrisA

[toc] | [standalone]


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


csiph-web