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


Groups > comp.lang.python > #52143

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

Date 2013-08-07 10:50 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: Bug? ( () == [] ) != ( ().__eq__([]) )
References <51FED74E.6080003@markusrother.de> <CAPTjJmp=FzJO5pA2WgcojcK4UneAwx8qWDqrC4GeqjO9dxHgfg@mail.gmail.com> <CAJQX3Dx0Kg7QNW47SEEPZ8eLWZsCsfAciM0vdMucZ_nQ7yb-SA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.323.1375897815.1251.python-list@python.org> (permalink)

Show all headers | View raw


On 08/07/2013 02:24 AM, Shiyao Ma 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?

A list that is empty is not equal to a tuple that is empty, much like a car that is empty is not equal to a boat that is 
empty.

--
~Ethan~

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


Thread

Re: Bug? ( () == [] ) != ( ().__eq__([]) ) Ethan Furman <ethan@stoneleaf.us> - 2013-08-07 10:50 -0700

csiph-web