warg.iteration.pairs

warg.iteration.pairs(s: Iterable) Generator[Tuple[Any, Any], None, None][source]

NOTE: Just use itertools.pairwise….

Iterate over a list in overlapping pairs.

Usage:

lst = [4, 7, 11, 2] pairs(lst) yields (4, 7), (7, 11), (11, 2)

https://stackoverflow.com/questions/1257413/1257446#1257446

Parameters:

s – An iterable/list

Returns:

Yields a pair of consecutive elements (lst[k], lst[k+1]) of lst. Last call yields (lst[-2], lst[-1]).