[Python-3000] Total ordering and cmp (original) (raw)

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