What does zip mean?

giacomo boffi pecore at pascolo.net
Thu Nov 13 17:10:56 EST 2014


Grant Edwards <invalid at invalid.invalid> writes:

> No, you don't. That's not how a zipper works.  Each tooth from side A,
> isn't bound with one from side B.  It's bound with _two_ of them from
> side B. And each of those is in turn bound with an additional tooth
> from side A, and so on...
>
>> In your program you have two lists, whose elements `zip` returns
>> bound together in pairs
>
> What the zipper on a coat does is convert two separate sequences into
> a single sequence where the members alternate between the two input
> sequences.  IOW if we want to do something analogous to a zipper
> fastener it should do this:
>
>   zip([a,b,c,d,e,f],[1,2,3,4,5,6])  => [a,1,b,2,c,3,d,4,e,5,f,6]
>   
> Item '1' is bound equally to item 'a' and 'b'.  Item 'b' is bound
> equally to item '1' and '2'.

I love you folks of CLP




More information about the Python-list mailing list