I have 2 lists that I want to combine into a single list of tuples, so that order is maintained and the result[i] is (first[i], second[i]). Assume
result[i]
(first[i], second[i])
Use izip:
>>> first = [1,2,3] >>> second = [4,5,6] >>> from itertools import izip >>> gen = izip(first, second) >>> [(i, j) for i, j in gen] [(1, 4), (2, 5), (3, 6)]