Python 3.0, rich comparisons and sorting order

Steven Bethard steven.bethard at gmail.com
Tue Sep 21 23:11:30 CEST 2004


Andrew Dalke <adalke <at> mindspring.com> writes:
> Get rid of __cmp__.

Do you think sort should lose its cmp keyword argument too?  Seems that might 
also address Carlos Ribeiro's 4-ways-to-customize-sort problem:

Carlos Ribeiro wrote:
> As of
> today, there are 4 different ways to customize sorting behavior:
> 
> 1) passing a comparison function to sort();
> 2) passing a key generation function to sort();
> 3) implementing __cmp__;
> 4) implementing rich comparison methods. 

There are things you can do with the cmp keyword arugment that you can't do 
with the key keyword argument...  Though I'm not sure how many of these things 
that you *can* do you actually *want* to do...

Steve




More information about the Python-list mailing list