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

Ethan Furman ethan at stoneleaf.us
Wed Aug 7 13:50:12 EDT 2013


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~



More information about the Python-list mailing list