Learning Scientific Programming with Python (2nd edition)
Q2.4.6: zip and its inverse
Question Q2.4.6
Explain why zip(*z)
is the inverse of z = zip(a, b)
– that is, whilst z
pairs the items: (a0, b0), (a1, b1), (a2, b2), ...
, zip(*z)
separates them again: (a0, a1, a2, ...), (b0, b1, b2, ...)