zip or marry etc

Peter Schneider-Kamp peter at schneider-kamp.de
Thu Jul 20 04:08:15 EDT 2000


Aahz Maruch wrote:
> 
> Oh, *that's* a good one.  All right, anyone else agree that "interleave"
> is the best suggestion we've had so far?

Not me. E.g.:

a = [1,2,3]
b = [4,5,6]
c = [7,8,9]
d = [10,11,12]

To me there are many interpretations (thinking of TV screens etc.):

interleave(a,b,c,d) == [1,2,3, 7,8,9, 4,5,6, 10,11,12]
or
interleave(a,b,c,d) == [1,2,3, 6,5,4, 7,8,9, 12,11,10]
or
interleave(a,b,c,d) == [1,7,4,10, 2,8,5,11, 3,9,6,12]
or
interleave(a,b,c,d) == [1,4,7,10, 2,5,8,11, 3,6,9,12]

The last one is the nearest I get, but for me interleave
is always producing one list.

Following the zip-is-compression argument, there will
also be people who think that

open("my_interlaced.gif","wb").write(interleave(open("my.gif","rb").read()))

will do the obvious thing ;-)

Peter
--
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter at schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de




More information about the Python-list mailing list