Guido rethinking removal of cmp from sort method
Dave Abrahams
dave at boostpro.com
Sun Mar 13 16:35:16 EDT 2011
Steven D'Aprano <steve+comp.lang.python <at> pearwood.info> writes:
> If anyone has any use-cases for sorting with a comparison function that
> either can't be written using a key function, or that perform really
> badly when done so, this would be a good time to speak up.
I think it's probably provable that there are no cases in the first category,
provided you're willing to do something sufficiently contorted. However,
it also seems self-evident to me that many programmers will rightly chafe
at the idea of creating and tearing down a bunch of objects just to
compare things for sorting. Think of the heap churn! Even if it turns out
that Python 3 contains some magic implementation detail that makes it
efficient most of the time, it goes against a natural understanding of the
computation model
2p for y'all.
-Dave
More information about the Python-list
mailing list