Message89591
| Author |
medwards |
| Recipients |
georg.brandl, medwards, rhettinger, terry.reedy |
| Date |
2009年06月22日.03:47:59 |
| SpamBayes Score |
1.3686887e-09 |
| Marked as misclassified |
No |
| Message-id |
<1245642482.43.0.430014964885.issue4395@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 user-defined classes
inherit, provides a single "rich comparison" method to which all of the
comparison operators (__eq__, __ne__, __lt__, __le__, __ge__, __gt__)
map. This method returns a non-trivial value (i. e., something other
than NotImplemented) in only two cases:
* When called as __eq__, if the two objects are identical, this method
returns True. (If they are not identical, it returns NotImplemented so
that the other object's implementation of __eq__ gets a chance to return
True.)
* When called as __ne__, it calls the equivalent of "self == other";
if this returns a non-trivial value X, then it returns !X (which is
always either True or False). |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2009年06月22日 03:48:02 | medwards | set | recipients:
+ medwards, georg.brandl, rhettinger, terry.reedy |
| 2009年06月22日 03:48:02 | medwards | set | messageid: <1245642482.43.0.430014964885.issue4395@psf.upfronthosting.co.za> |
| 2009年06月22日 03:48:00 | medwards | link | issue4395 messages |
| 2009年06月22日 03:47:59 | medwards | create |
|