Peter Otten wrote:
Steven Bethard wrote:
def __eq__(self, other):
"""x.__eq__(y) <==> x == y"""
return (isinstance(other, self.__class__)
and self.__dict__ == other.__dict__)
This results in an asymmetry:
[snip]
Whether this is intended, I don't know. If someone can enlighten me...
In any case I would prefer self.__class__ == other.__class__ over
isinstance().
Unintended. I'll switch to
self.__class__ == other.__class__
or
type(self) == type(other)
Any preference?
Steve
--
http://mail.python.org/mailman/listinfo/python-list