pairwise

sknano.core.pairwise(iterable)[source] [edit on github][source]

Returns an iterator of paired items, overlapping, from the original.

Examples

>>> from sknano.core import pairwise, tabulate, take
>>> t = tabulate(lambda i: i)
>>> take(5, pairwise(t))
[(0, 1), (1, 2), (2, 3), (3, 4), (4, 5)]
>>> take(5, pairwise(t))
[(6, 7), (7, 8), (8, 9), (9, 10), (10, 11)]