Author medwards
Recipients georg.brandl, medwards, rhettinger, terry.reedy
Date 2009-06-22.05:08:34
SpamBayes Score 2.27062e-06
Marked as misclassified No
Message-id <1245647317.58.0.160965665456.issue4395@psf.upfronthosting.co.za>
In-reply-to
Content
It would also be useful to point out that there is a shortcut in the
interpreter itself (PyObject_RichCompareBool, in object.c) which checks
the equivalent of id(a) == id(b) and bypasses __eq__/__ne__ if so. 
Since not every call to __eq__ passes through this function, it's fairly
important that implementations of __eq__ return either True or
NotImplemented when id(a) == id(b).  Ditto for extension modules;
anything that installs its own tp_richcompare should handle object
identity and __ne__ in substantially the same way, so that subclass
authors can rely on the documented behavior when overriding __eq__.
History
Date User Action Args
2009-06-22 05:08:38medwardssetrecipients: + medwards, georg.brandl, rhettinger, terry.reedy
2009-06-22 05:08:37medwardssetmessageid: <1245647317.58.0.160965665456.issue4395@psf.upfronthosting.co.za>
2009-06-22 05:08:35medwardslinkissue4395 messages
2009-06-22 05:08:35medwardscreate