This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author andymaier
Recipients andymaier, chris.jerdonek, cvrebert, docs@python, ezio.melotti, mark.dickinson, mikehoy, rhettinger, terry.reedy
Date 2014-07-07.08:12:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1404720752.53.0.29322956692.issue12067@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2014-07-07 08:12:32andymaiersetrecipients: + andymaier, rhettinger, terry.reedy, mark.dickinson, ezio.melotti, cvrebert, chris.jerdonek, docs@python, mikehoy
2014-07-07 08:12:32andymaiersetmessageid: <1404720752.53.0.29322956692.issue12067@psf.upfronthosting.co.za>
2014-07-07 08:12:32andymaierlinkissue12067 messages
2014-07-07 08:12:31andymaiercreate