tee
fromitertools
is cool! link
from itertools import tee
i, j = tee(data)
next(j)
for first, second in zip(i, j):
'from itertools import tee',
'a = range(10)',
'next(a)',
'a = iter(range(10))',
'next(a)',
'a',
'b = tee(a)',
'tee',
'c = next(tee)',
'e, f = b',
'e',
'next(e)',
'next(f)',
'next(f)',
'next(f)',
'next(f)',
'next(e)',
6: 0,
7: <range_iterator at 0x113f05f60>,
9: <function itertools.tee>,
12: <itertools._tee at 0x1150f6e08>,
13: 1,
14: 1,
15: 2,
16: 3,
17: 4,
18: 2,