[Baypiggies] processing multiple lists in step

Daryl Spitzer daryl.spitzer at gmail.com
Thu Sep 10 16:45:08 CEST 2009


See the zip() built-in function:
http://docs.python.org/library/functions.html#zip.  I note the
documentation says it returns a list of tuples, which is (I assume)
why Charles writes "for in memory objects".

For an iterator, see itertools.izip() or itertools.izip_longest():
http://docs.python.org/library/itertools.html#itertools.izip.

--
Daryl


On Thu, Sep 10, 2009 at 12:20 AM, Charles Merriam
<charles.merriam at gmail.com> wrote:
> Cool.   For in memory objects, one might use zip().
>
> Anyone care to have a Pythonic lunch at the Dojo on Monday?
>
> On Thu, Sep 10, 2009 at 12:08 AM, Jeff Enderwick
> <jeff.enderwick at gmail.com> wrote:
>> I like using list-comps in Python. Is there a nice way to process more
>> than one list concurrently in this style? By this, I mean that the 1st
>> iteration would act on L1[0] and L2[0], the 2nd iteration would act on
>> L1[1] and L2[1], and so on. Sorry if the soln is obvious - I am tired
>> :-)
>> _______________________________________________
>> Baypiggies mailing list
>> Baypiggies at python.org
>> To change your subscription options or unsubscribe:
>> http://mail.python.org/mailman/listinfo/baypiggies
>>
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>


More information about the Baypiggies mailing list