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

Raymond Hettinger raymond.hettinger at gmail.com
Sun Mar 13 04:00:00 CET 2011


On Mar 12, 2011, at 3:44 PM, Guido van Rossum wrote:

> I was just reminded that in Python 3, list.sort() and sorted() no
> longer support the cmp (comparator) function argument. The reason is
> that the key function argument is always better. But now I have a
> nagging doubt about this:
> 
> I recently advised a Googler who was sorting a large dataset and
> running out of memory. 

. . .

> But in Python 3 this solution is no longer available. How bad is that?
> I'm not sure. But I'd like to at least get the issue out in the open.
> 


Python3.2 should be substantially better in this regard.
It no longer wraps key objects around every input.  Instead, it
sorts two parallel arrays of pointers.   You can thank Daniel
Stutzbach (another Googler I believe) for this effort.


Raymond



More information about the Python-Dev mailing list