Terry Reedy wrote:
"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.

Yes, the asymmetry is due to isinstance.

I believe what Peter Otten was pointing out is that calling __eq__ is not the same as using ==, presumably because the code for == checks the types of the two objects and returns False if they're different before the __eq__ code ever gets called.

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

Reply via email to