[Python-3000] Total ordering and __cmp__

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Mar 21 23:16:32 CET 2007


Adam Olsen wrote:
> On 3/20/07, Steven Bethard <steven.bethard at gmail.com> wrote:
>
> > I've used a __key__() method quite successfully in my own code.  Maybe
> > we should provide a mixin like::
 >
> This seems to match what I've usually needed, but I'm not sure it's
> worth putting in python proper.

In addition to this, what about the idea of a Python-level
__richcmp__ method? It would provide a single point of override
for classes that wanted to use it, and it shouldn't upset any
default behaviours since it's just exposing what's there
at the C level anyway.

--
Greg




More information about the Python-3000 mailing list