A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-July/006371.html below:

[Python-Dev] Iterating in parallel

[Python-Dev] Iterating in parallelKa-Ping Yee ping@lfw.org
Thu, 13 Jul 2000 03:41:45 -0700 (PDT)
On Thu, 13 Jul 2000, Jack Jansen wrote:
> 
> intertwine() and interlace() both give me the right feeling. Although with 
> interlace I might be tempted to pass it two 320x480 bitmaps and assume an NTSC 
> image will come out:-)

Sorry for flip-flopping on this -- to Paul especially -- but
parallel() is looking better and better as i compare it with
these other alternatives.

It seems clear that the most common use of this thing is in a
parallel-iteration idiom, and that it would be quite rarely
used as part of an expression elsewhere.  Given that, consider:

    for x, y, z in marry(a, b, c): print x + y + z

    for x, y, z in twine(a, b, c): print x + y + z

    for x, y, z in lace(a, b, c): print x + y + z

    for x, y, z in zip(a, b, c): print x + y + z

    for x, y, z in parallel(a, b, c): print x + y + z

Which one makes its behaviour most obvious to you?  For me,
parallel() really stands out.  It's so strong that it could
outweigh the potential connotation of concurrency.  (In fact,
it *is* sort of concurrent.  If each list were a generator,
they would all be running concurrently to produce the triplets
we're requesting.)

(If "parallel" disturbs you too much, the concept of parallel
*movement* inspires me to suggest "march", which has all of that
good walking-together-in-lock-step feeling, with none of the
twisty feeling i get from "twine" or "lace" or the
alternating-back-and-forth feeling i get from "weave" or "interlace".)


-- ?!ng




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4