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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to