Michael K. Edwards 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
Michael K. Edwards added the comment:
The implementation you are looking for is in object_richcompare, in
http://svn.python.org/projects/python/branches/py3k/Objects/typeobject.c
. It would be most accurate to say something like:
The "object" base class, from which all us
Michael K. Edwards <[EMAIL PROTECTED]> added the comment:
It would be really useful to explain, right in this section, why __ne__
is worth having. Something along these lines (based on the logic from
Python 2.x -- modify as necessary):
The values most commonly returned by the rich comp