[Python-Dev] Python3 regret about deleting list.sort(cmp=...)

Nick Coghlan ncoghlan at gmail.com
Sat Mar 12 22:58:44 CET 2011


On Sat, Mar 12, 2011 at 4:50 PM, Reid Kleckner <reid.kleckner at gmail.com> wrote:
> They should be able to use a slotted cmp_to_key style class:
> http://docs.python.org/howto/sorting.html
>
> That will allocate 1 Python object with no dict per key, but that
> might not be good enough.

Tuples are already slotted, so that isn't likely to help in this case.

The basic point is that cmp vs key is actually a classic space vs
speed trade-off, and by removing the "cmp" option, we prevent people
from making that trade-off for themselves.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list