[Python-Dev] what to call this zip() function?

Ka-Ping Yee ping@lfw.org
Sat, 15 Jul 2000 11:34:57 -0700 (PDT)


Skip Montanaro wrote:
> How about collate?

The analogy with a photocopying machine is pretty good, but
i'm afraid this will play havoc with those who see "collate" in
terms of determining sort order.

                          *      *      *

With me acting as the user and a willing guinea pig playing the
part of the Python interpreter, i got the following results:

    >>> a = [1, 2, 3]
    >>> b = [4, 5, 6]
    >>> c = [7, 8, 9]

    >>> for x, y, z in twine(a, b, c):
    ...     print x, y, z
    1 5 9
    2 6 7
    3 4 8

    >>> for x, y, z in weave(a, b, c):
    ...     print x, y, z
    1 5 7
    2 4 8
    3 None 9
    None 6 None

    >>> for x, y, z in parallel(a, b, c):
    ...     print x, y, z
    1 4 7
    2 5 8
    3 6 9

                          *      *      *

On Fri, 14 Jul 2000, Eric S. Raymond wrote:
> No, *I* wrote `plait() is *good*.'
>
> In English, `plait' is a slightly unusual word with a meaning almost
> indistinguishable from `braid'.

...which is almost entirely the *wrong* meaning, imho.

Here are the pictures i get from the words suggested so far.


splice                             furl

                                                  _______
                --> <--                          / _____ \
         --------=   =-------                   / /     \ \
                                                \_______/ /
                                              ___________/


twine             /|\              lace            -%-
                  \|/                              \ /
                   \                                X
                  /|\                              / \
                  \|/                              \ /
                   \                                X
                  /|\                              (_)
                  \|/


braid            / \ /             plait        |        | 
plait           |   /                (sense 2)  | _______|_
  (sense 1)      \ / \                          |/|        |
                  \   |                           | _______|_
                 / \ /                            |/|        |
                |   /                               |        |
                 \ / \                              |        |
                  \   |
                 / \ /


weave       -|-----|-----|-       interlace  ----------->
interweave   |  |  |  |  |        interleave    <-----------
knit        ----|-----|----                  ----------->
             |  |  |  |  |                      <-----------
            -|-----|-----|-                  ----------->
             |  |  |  |  |                      <-----------
            ----|-----|----                  ----------->
             |  |  |  |  |                      <-----------
            -|-----|-----|-


parallel    ---------------       march      ------ o-> -  -  -

            ---------------                  ------ o-> -  -  -

            ---------------                  ------ o-> -  -  -

            ---------------                  ------ o-> -  -  -


zip            o       o          merge          |  |  |
marry           o     o           (herd?)        |  |  |
                 o   o                            \ | /
                  o-o                              \|/
                  o-o                               |
                  o-o                               |
                  o-o                               |
                  o-o                               v


                          *      *      *

It's fairly clear to me that, of the names that evoke images
of some sort, only "parallel", "march", and "merge" are actually
accurate.  "zip" and "marry" are nearly accurate except that they
usually give the impression that only two things are being joined.

Of these five options, "zip" and "parallel" have potentially
misleading meanings.  "merge" sounds the most neutral to me.
"tuples" is also very neutral (though it doesn't really suggest
*how* the tuples are obtained).

Therefore, i'm down to "merge", "tuples", or "march" (maybe "herd");
i'd be quite happy with "parallel" or "zip" but others have
already come out strongly against those two.

                          *      *      *

Finally, on the lighter side... more ideas from my twisted mind.

    for x, y, z in rearrange(a, b, c)?

    for x, y, z in herd(a, b, c)?

    for x, y, z in mutilate(a, b, c)?

    for x, y, z in harass(a, b, c)?

    for x, y, z in abuse(a, b, c)?

    for x, y, z in torture(a, b, c)?


A friend also suggested a name reminiscent of our discussion.

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

You want an argument?  Oh, this is abuse.  Arguments are down the hall.



-- ?!ng