[Tutor] Grouping based on attributes of elements in a List

Rafael Durán Castañeda rafadurancastaneda at gmail.com
Wed Mar 30 09:13:59 CEST 2011

You are right, lambda lis: lis[1:3] would be more readable

2011/3/30 Sander Sweers <sander.sweers at gmail.com>

> On 30 March 2011 00:30, Alan Gauld <alan.gauld at btinternet.com> wrote:
> > Wouldn't you just return a tuple of the two elements?
> >
> > Or am I missing something having jumped into the middle of the thread...
> Ah yes, you are correct. But imo reading "key=lambda l: (l[1], l[0],
> l[2])" (which would be needed to sort how the OP wanted) hurts my eyes
> ;-). Anyway, both options will work fine for the OP.
> Greets
> Sander
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110330/68d23159/attachment.html>

More information about the Tutor mailing list