Guido rethinking removal of cmp from sort method

Aahz aahz at pythoncraft.com
Fri Apr 8 11:08:06 EDT 2011


In article <4D8BE3BB.4030508 at v.loewis.de>,
Martin v. Loewis <martin at v.loewis.de> wrote:
>Martin deleted the attribution for Carl Banks:
>>
>> The cmp argument doesn't depend in any way on an object's __cmp__
>> method, so getting rid of __cmp__ wasn't any good readon to also get
>> rid of the cmp argument
>
>So what do you think about the cmp() builtin? Should have stayed,
>or was it ok to remove it?
>
>If it should have stayed: how should it's implementation have looked like?
>
>If it was ok to remove it: how are people supposed to fill out the cmp=
>argument in cases where they use the cmp() builtin in 2.x?

Actually, my take is that removing __cmp__ was a mistake.  (I already
argued about it back in python-dev before it happened, and I see little
point rehashing it.  My reason is strictly efficiency grounds: when
comparisons are expensive -- such as Decimal object -- __cmp__ is
faster.)
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Beware of companies that claim to be like a family.  They might not be
lying."  --Jill Lundquist



More information about the Python-list mailing list