"Steven Bethard" <[EMAIL PROTECTED]> wrote in message
 >>>def __eq__(self, other):
>>>    """x.__eq__(y) <==> x == y"""
>>>    return (isinstance(other, self.__class__)

Since an instance of a subclass is an instance of a parent class, but not 
vice versa, I believe you introduce here the assymetry you verify below.

>>>            and self.__dict__ == other.__dict__)
>> This results in an asymmetry:
>>
>>>>>from bunch import Bunch
>>>>>class B(Bunch): pass
>> ...
>>>>>B().__eq__(Bunch())
>> False
>>>>>Bunch().__eq__(B())
>> True

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to