On Sun, 16 Nov 2008 23:34:58 -0500, Terry Reedy wrote: > Steven D'Aprano wrote:
>>>>> class EqualsAll(object): >> ... def __eq__(self, other): >> ... return True >> ... >>>>> 5 == EqualsAll() >> True >> >> >> The methods of 5 don't even get called. > > Why do you say that? As I read the manual, type(left-operand).__eq__ is > called first. Ah, I could be confabulating that with arithmetic operators __add__ etc. It may be that comparisons use a different mechanism: >>> 5 .__cmp__(EqualsAll()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: int.__cmp__(x,y) requires y to be a 'int', not a 'EqualsAll' -- Steven -- http://mail.python.org/mailman/listinfo/python-list