zip is it's own inverse
You can undo the zipping operation using zip itself.
By using the unpacking operator * you don't have to manually specify the number of arguments (although I do assume the return of two components in the example below).
In Python 3, the zip operator returns a generator instead of a list, so you need to explicitly cast to a list if you want one.
>>> a = [1, 3]
>>> b = [2, 4]
>>> c = list(zip(a,b))
>>> c
[(1, 2), (3, 4)]
>>> a, b = list(zip(*c))
>>> a
(1, 3)
>>> b
(2, 4)
The inverse operation will always return tuples, so if your original input was a list, you also need to convert back the results to a list.
This operation is super handy.
For example, I wrote a class to recommend relevant texts for a query document based on their distance in a vector space.
The recommend() function of this class returns a list of recommended text and a list of relevant metadata about those text as tuples.
So the metadata looks a bit like this: meta =[ (distance, document_id, type), (distance, document_id, type), ... ].
This list will be long.
You may be interested in easily retrieving all distances, document_ids etc. as a list of their own as such:
distances, document_ids, types = zip(*meta).