[docs] [issue12067] Doc: remove errors about mixed-type comparisons.
Andy Maier
report at bugs.python.org
Mon Jul 7 10:12:32 CEST 2014
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 <report at bugs.python.org>
<http://bugs.python.org/issue12067>
_______________________________________
More information about the docs
mailing list