Andy Maier added the comment:

I see.
But I don't think it is a sensible default, as the source code states.

The Python doc (v2 and v3) is quite consistent in stating that `==` compares 
the values of two objects, while `is` compares object identity.

Having a default implementation on the object type that implements `==` by 
comparing object identity is not consistent with that.

-> Can someone please elaborate what the reason for that is?

-> Where is the discrepancy between the documentation of == and its default 
implementation on object documented?

To me, a sensible default implementation for == on object would be (in Python):

  if v is w:
    return True;
  elif type(v) != type(w):
    return False
  else:
    raise ValueError("Equality cannot be determined in default implementation")

Andy

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12067>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to