[Python-3000] Please re-add __cmp__ to python 3000
Guido van Rossum
guido at python.org
Wed Oct 17 19:23:39 CEST 2007
On 10/17/07, David A. Wheeler <dwheeler at dwheeler.com> wrote:
> I said:
> > I agree with Collin Winter: losing __cmp__ is a loss (see http://oakwinter.com/code/).
>
> Steven Bethard said:
> >Why can't this just be supplied with a mixin? Here's a recipe
> >providing the appropriate mixins if you want to define a __key__
> >function:
> > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/510403
>
> That _works_ from a functional perspective, and if Python3 fails to include direct support for __cmp__, then I think providing a built-in mixin is necessary.
>
> But mixins for comparison are a BIG LOSER for sort performance if your fundamental operator is a cmp-like function.
However, note that Python's sort() and sorted() are guaranteed to only use '<'.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list