[Python-3000] Please re-add cmp to python 3000 (original) (raw)

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