Q: sort's key and cmp parameters

Laszlo Nagy gandalf at shopzeus.com
Thu Oct 1 20:05:21 CEST 2009


>> can be achieved (to a very good approximation at least) with
>>
>> scrambled = some_list.sort(key=lambda x: random())
>>
>> Is there a real-life sorting task that requires (or is far more
>> efficient with) cmp and can't be easily achieved with key and
>> reverse?
>>     
>
> The core developers don't think there is one. list.sort() no longer supports 
> the cmp parameter in 3.x.
>   
LOL :-D

BTW if you really want to sort a list then you can. Using keys or 
values, it doesn't matter. The op's question has no practical usage. 
REALLY looks like a homework.

   L




More information about the Python-list mailing list