O_o

List comprehensions never cease to amaze me.

Thanks,


On 3/7/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> En Wed, 07 Mar 2007 21:41:16 -0300, Sergio Correia
> <[EMAIL PROTECTED]> escribió:
>
> > I forgot to say: I've already checked the discussions about
> > recursive/iterative/etc flatten() functions that can sweep through a
> > list of arbitrary length, but that's really overkill for what I want.
> >
> > However, "sum(eggs, [])" or itertools seem to do it w/out the need for
> > a new function.
> >
> > Thanks a lot!
>
> Just for being (a little!) constructive, given your preconditions on the
> list, you can use:
> eggs = [item for sublist in spam for item in sublist]
>
> --
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to