Q: sort's key and cmp parameters
Ethan Furman
ethan at stoneleaf.us
Thu Oct 1 14:21:38 EDT 2009
Laszlo Nagy wrote:
>
>>> 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
>
If it is, it's one he's contemplating giving his students. :-D
~Ethan~
More information about the Python-list
mailing list