[portland] Extracting strings from a tuple
Jeff Schwaber
freyley at gmail.com
Sat Nov 3 01:11:35 CET 2007
On 11/2/07, Matt McCredie <mccredie at gmail.com> wrote:
> In python if you find yourself doing 'range(len(something))' it is
> time to backup and re-evaluate. Heck, you can even use list
> comprehension without the range(len(a[0])):
>
> [val for val in a[0]]
This is really the best form for this particular discussion because we
don't know quite what Rich is doing.
> > To unpack that, it's a list comprehension which look like this:
> >
> > [a for a in listofthings ]
>
> What are you doing here? Just making a copy? That is better written:
I'm not assuming Rich is familiar with list comprehensions and so was
attempting to describe their general form. Your use is cleaner,
though.
Thanks,
Jeff
More information about the Portland
mailing list