[Python-Dev] zip() and list-comprehension with commas

Barry A. Warsaw bwarsaw@beopen.com
Tue, 11 Jul 2000 23:44:47 -0400 (EDT)


>>>>> "KY" == Ka-Ping Yee <pingster@ilm.com> writes:


    KY> I like this idea.  This whole parallel iteration thing could
    KY> be solved with a single built-in and no syntax changes.

    KY>     for x, y in parallel([10, 20, 30], [1, 2]):

    KY> Or "zip", since you're zipping the lists together (i foresee
    KY> potential geometric or concurrency-related interpretations of
    KY> "parallel"):

Definitely +1 on concept.  The nice bit is that parallel() or zip()
can return objects that iterate efficiently.  -0 on zip(), +0 on
parallel(), +0 on making them builtins.

Alternatives (as Greg I think brought up): pairwise(), maybe zipper()
for zip() since it's more evocative.

-Barry