Dividing a list into equal chunks is neatly done using the zip(*[iter(s)]*n)
idiom. Is there a nice way of undoing it?
For example, if I have the following code:
>>> s = [3,4,1,2]
>>> zip(*[iter(s)]*2)
[(3, 4), (1, 2)]
Is there some function func([(3,4),(1,2)]
that will yield [3,4,1,2]
as the output?
Edit:
Timing and more solutions can be found in the question linked to by Dominic Kexel below.