[Python-3000] Please re-add __cmp__ to python 3000

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Oct 30 01:08:39 CET 2007


Adam Olsen wrote:
> It's not clear to me how many distinct operations you'd need though,
> or how acceptable reflections would be.

My intention was just to directly expose the tp_richcmp
slot, so there would be six.

To make things easier in the common case, there could
perhaps be a utility function that would take a comparison
operation code and a -1, 0, 1 value and return the
appropriate boolean. Then a __richcmp__ method could be
written very similarly to the way a __cmp__ method is
now. It might even be possible for 2to3 to convert
__cmp__ methods to __richcmp__ methods automatically.

--
Greg


More information about the Python-3000 mailing list