Message222442
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 |
|
Date |
User |
Action |
Args |
2014-07-07 08:12:32 | andymaier | set | recipients:
+ andymaier, rhettinger, terry.reedy, mark.dickinson, ezio.melotti, cvrebert, chris.jerdonek, docs@python, mikehoy |
2014-07-07 08:12:32 | andymaier | set | messageid: <1404720752.53.0.29322956692.issue12067@psf.upfronthosting.co.za> |
2014-07-07 08:12:32 | andymaier | link | issue12067 messages |
2014-07-07 08:12:31 | andymaier | create | |
|