I have noticed this behavior:
import itertools as iter
truc = iter.count(0)
trac = ["a",'b','c','d','e']
for i in range(3):
zap = [x for x,y in zip(truc,trac)]
print(zap)
which outputs
[0, 1, 2, 3, 4]
[6, 7, 8, 9, 10]
[12, 13, 14, 15, 16]
I don't understand why the second list is not ```[5,6,7,8,9]```. And the same goes for the third list, why it does not start at 11 ?
zip()advances the iterators in left to right order - it callsnext(truc), and then (possibly)next(trac). But whentrucyields 5,trachas reached its end, so the overallzip()process ends. So the 5 gets wasted, it has no place inzip's output, and there's no way to stuff it back into the iterator it came from.