Chris Rebert:
> So the improved code is:
> your_list.sort(key=lambda elem: (elem[3], elem[2]), reverse=True)
Better (untested):
from operator import itemgetter
...
your_list.sort(key=itemgetter(3, 2), reverse=True)
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
I did see that actually, I thought it was only applied to specifying default
parameters and wasn't sure if it ALSO applied to putting it into a function.
In a way however, I see what you're getting at - it's basically the same
thing you're just specifying a default value the same way...
Ok problem
On Thu, Oct 2, 2008 at 8:07 PM, David Di Biase <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I'm sorting an expansive list descending according to a list of tuples.
> Basically it has to sort the last value in the tuple (3) but if they are the
> same then it should resort to using the second last valu