Michael K. Edwards <m.k.edwa...@gmail.com> added the comment: 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__.
---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4395> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com