Let\'s say i have an array of Tuples, s, in the form of:
s = ((1, 23, 34),(2, 34, 44), (3, 444, 234))
and i want to return another Tuple,
import itertools
s = ((1, 23, 34),(2, 34, 44), (3, 444, 234))
print(next(itertools.izip(*s)))
itertools.izip returns an iterator. The next function returns the next (and in this case, first) element from the iterator.
In Python 2.x, zip returns a tuple.
izip uses less memory since iterators do not generate their contents until needed.
In Python 3, zip returns an iterator.