>>> f = (2, 3, 4, 5)
>>> zip(f[:-1], f[1:])
[(2, 3), (3, 4), (4, 5)]
Или из документов :
>>> from itertools import tee, izip
>>> def pairwise(iterable):
... "s -> (s0,s1), (s1,s2), (s2, s3), ..."
... a, b = tee(iterable)
... next(b, None)
... return izip(a, b)
...
>>> tuple(pairwise(f))
((2, 3), (3, 4), (4, 5))