[Python-3000] Total ordering and __cmp__
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Mar 22 04:13:36 CET 2007
Daniel Stutzbach wrote:
> I apologize if this is a silly question, but what would be the
> difference between the proposed __richcmp__ and the old __cmp__ that's
> being removed?
__richcmp__ would have the same signature as the C-level
tp_richcmp slot, i.e. taking a code indicating which
comparison to perform, and returning an arbitary value
instead of -1, 0, 1.
With this, you would be able to do anything that could
be done with __lt__, __eq__, etc., but only have to
override a single method.
--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | Carpe post meridiem! |
Christchurch, New Zealand | (I'm not a morning person.) |
greg.ewing at canterbury.ac.nz +--------------------------------------+
More information about the Python-3000
mailing list