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

Adam Olsen rhamph at gmail.com
Tue Oct 30 22:36:57 CET 2007


On 10/30/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Adam Olsen wrote:
> > It'd be simpler still if we only had __cmp__ and __eq__.  I just don't
> > understand the use cases where that's not sufficient.
> >
> > Hrm.  I guess set's subset checking requires more relationships than
> > __cmp__ provides.
>
> Also, you might want to give the comparison operators meanings
> that don't have anything to do with comparison in the usual
> sense. The reason tp_richcmp was added in the first place was
> so that arbitrary meanings could be given to the comparison
> operators individually.

Yeah.

It's clear to me that the opposition to removing __cmp__ comes down to
"make the common things easy and the rare things possible".  Removing
__cmp__ means one of the common things (total ordering) becomes hard.
__richcmp__ might solve that, but I'd like to see some larger examples
first (involving unordered types, total ordered types, and partially
ordered types.)


-- 
Adam Olsen, aka Rhamphoryncus


More information about the Python-3000 mailing list