Bug? ( () == [] ) != ( ().__eq__([]) )
Chris Angelico
rosuav at gmail.com
Wed Aug 7 05:43:07 EDT 2013
On Wed, Aug 7, 2013 at 10:24 AM, Shiyao Ma <i at 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
More information about the Python-list
mailing list