[Python-Dev] zip() and list-comprehension with commas
Moshe Zadka
Moshe Zadka <moshez@math.huji.ac.il>
Wed, 12 Jul 2000 08:22:06 +0300 (IDT)
On Tue, 11 Jul 2000, Ka-Ping Yee wrote:
> On Tue, 11 Jul 2000, Paul Prescod wrote:
> >
> > Parallel iteration and list comprehensions are separate. I do prefer a
> > parallel() (merge?) builtin to the semicolon syntax, myself. You could
> > even define xparallel which is the lazy version (as in xrange).
>
> I like this idea. This whole parallel iteration thing could be solved
> with a single built-in and no syntax changes.
>
> for x, y in parallel([10, 20, 30], [1, 2]):
>
> Or "zip", since you're zipping the lists together (i foresee potential
> geometric or concurrency-related interpretations of "parallel"):
+1 on prefering a builtin to a syntax change
> for x, y in zip([10, 20, 30], [1, 2]):
>
> [(x, y+z), for (x, y) in zip((1, 2, 3, 4, 5, 6), "abc"), for z in "de"]
+1 on that too...really clear
--
Moshe Zadka <moshez@math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.
http://advogato.org/person/moshez