Message89592
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__. |
|
Date |
User |
Action |
Args |
2009-06-22 05:08:38 | medwards | set | recipients:
+ medwards, georg.brandl, rhettinger, terry.reedy |
2009-06-22 05:08:37 | medwards | set | messageid: <1245647317.58.0.160965665456.issue4395@psf.upfronthosting.co.za> |
2009-06-22 05:08:35 | medwards | link | issue4395 messages |
2009-06-22 05:08:35 | medwards | create | |
|