no more comparisons
Terry Reedy
tjreedy at udel.edu
Wed Mar 12 21:18:55 EDT 2008
| > Hmm, wasn't aware they were taking it that far. You should almost
| > always avoid using the cmp parameter because it's very inefficient;
|
| I don't see what's so inefficient about it necessarily.
The key function is called once per list item, for n calls total. The
comparision function is called once per comparision. There are at least
n-1 such calls and typically something on the order of n * lg2(n) calls.
More information about the Python-list
mailing list