Guido rethinking removal of cmp from sort method
Jean-Michel Pichavant
jeanmichel at sequans.com
Mon Mar 14 09:37:56 EDT 2011
Steven D'Aprano wrote:
> On Mon, 14 Mar 2011 12:10:27 +0100, Jean-Michel Pichavant wrote:
>
>
>> Steven D'Aprano wrote:
>>
>>> The removal of cmp from the sort method of lists is probably the most
>>> disliked change in Python 3. On the python-dev mailing list at the
>>> moment, Guido is considering whether or not it was a mistake.
>>>
>>> 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.
>>>
>>>
>>>
>>>
>>>
>> You seem concerned by this removal, do you have any use-case ?
>>
>
> You seem concerned by my concern. Why do you think I am concerned?
>
> (1) I'm not concerned, but many people are. If you search the archives of
> this newsgroup (mailing list), you'll see that I have defended the
> removal of cmp from sort, e.g. this post:
>
> http://www.mail-archive.com/python-list%40python.org/msg261728.html
>
>
> (2) If I had a good use-case for keeping cmp, I wouldn't need to ask
> others if they had a good use-case.
>
> As it is, Guido himself has mentioned one such good use for a comparison
> function when sorting. Use of a key function trades off memory for time,
> while sorting with a comparison function makes the opposite trade off,
> using more time for the sake of saving memory.
>
>
Just to know if currently the use-case count is zero. Nothing evil
hidden behind my question :p
JM
More information about the Python-list
mailing list