Why/When in Python does `x==y` call `y.__eq__(x)`?
You’re missing a key exception to the usual behaviour: when the right-hand operand is an instance of a subclass of the class of the left-hand operand, the special method for the right-hand operand is called first. See the documentation at: http://docs.python.org/reference/datamodel.html#coercion-rules and in particular, the following two paragraphs: For objects x and y, first x.__op__(y) … Read more