[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

Guido van Rossum report at bugs.python.org
Fri Dec 4 23:49:40 CET 2009


Guido van Rossum <guido at python.org> added the comment:

Can someone provide a code sample to make this argument more 
understandable for those of us who don't compare points by angular order 
for a living... :-)

I'm not sure what the 2to3 example (I presume you mean msg59937) shows 
except that conversion from a cmp function to a key function may require 
you to actually think...

Also, for all of you asking for cmp back, I hope you realize that 
sorting N values using a custom cmp function makes about N log N calls 
calls to cmp, whereas using a custom key calls the key function only N 
times.  This means that even if your cmp function is faster than the 
best key function you can write, the advantage is lost as N increases 
(which is just where you'd like it to matter most :-).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1771>
_______________________________________


More information about the Python-bugs-list mailing list