On Mon, 16 Jan 2006 21:58:26 +1100, Steven D'Aprano <[EMAIL PROTECTED]> wrote:

>On Mon, 16 Jan 2006 10:34:40 +0000, Bengt Richter wrote:
>
>>  >>> class A:
>>  ...     def __getattr__(self, attr): print 'A().%s'%attr; raise 
>> AttributeError
>>  ...
>>  >>> class B:
>>  ...     def __getattr__(self, attr): print 'B().%s'%attr; raise 
>> AttributeError
>>  ...
>>  >>> A()==B()
>>  A().__eq__
>>  B().__eq__
>>  B().__eq__
>>  A().__eq__
>>  A().__coerce__
>>  B().__coerce__
>>  A().__cmp__
>>  B().__cmp__
>>  False
>
>Why are A().__eq__ and B().__eq__ both being called twice?
>
I imagine it's trying the calls with args swapped or something like that.
Want to write a test and see? (Don't hold your breath if you're waiting for me 
to do it ;-)

Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to