[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()
report at bugs.python.org
Sun Feb 17 02:45:57 CET 2008
Lea Wiemann added the comment:
Is this really necessary?
I see that the sorting code gets a little simpler, but I believe that
there are valid use cases for cmp out there, where using a key would at
least be cumbersome. So why remove it when it's useful?
For instance, if you have an algorithm to determine the order in which
any two elements should occur (and for some reason the algorithm
satisfies transitivity) then it's usable as the cmp function, but
turning it into a key function may be complicated (and adversly affect
performance); you might end up having to map each element to a number
or tuple describing the ordering properties of the element, which can
be non-trivial. Besides, it can also be non-obvious.
Tracker <report at bugs.python.org>
More information about the Python-bugs-list