We saw in Section 3.1.5: Merging Lists that it is possible to create a list out of two or more lists by zipping them together. The same operation exists for iterators:
xg = x_iterator() # some iterator yg = y_iterator() # another iterator for x, y in zip(xg, yg): print(x, y)
The zipped iterator stops as soon as one of the iterators is exhausted. This is the same behavior as the operation zip on lists.