Guido rethinking removal of cmp from sort method
OKB (not okblacke)
brenNOSPAMbarn at NObrenSPAMbarn.net
Sat Mar 26 04:14:28 EDT 2011
Steven D'Aprano wrote:
> On Fri, 25 Mar 2011 10:21:35 +0100, Antoon Pardon wrote:
> The reason Guido is considering re-introducing cmp is that somebody
> at Google approached him with a use-case where a key-based sort did
> not work. The use-case was that the user had masses of data, too
> much data for the added overhead of Decorate-Sort-Undecorate (which
> is what key does), but didn't care if it took a day or two to sort.
>
> So there is at least one use-case for preferring slowly sorting
> with a comparison function over key-based sorting. I asked if there
> any others. It seems not.
That is one use case for preferring cmp. Another use case is "I
can easily think of how to write the cmp function and not the key
function and I don't care about either speed or memory usage". There's
more to practicality than code execution speed.
--
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is
no path, and leave a trail."
--author unknown
More information about the Python-list
mailing list