opposite of zip()?

igor.tatarinov at gmail.com igor.tatarinov at gmail.com
Sat Dec 15 00:47:06 EST 2007


Given a bunch of arrays, if I want to create tuples, there is
zip(arrays). What if I want to do the opposite: break a tuple up and
append the values to given arrays:
   map(append, arrays, tupl)
except there is no unbound append() (List.append() does not exist,
right?).

Without append(), I am forced to write a (slow) explicit loop:
  for (a, v) in zip(arrays, tupl):
      a.append(v)

I assume using an index variable instead wouldn't be much faster.

Is there a better solution?

Thanks,
igor



More information about the Python-list mailing list