aioplus.apairwise

aioplus.apairwise(aiterable, /)

Return a sliding window of width n=2 over aiterable.

Parameters:

aiterable (AsyncIterable[T]) – Iterable.

Returns:

Iterator.

Return type:

AsyncIterator[tuple[T, T]]

Examples

>>> aiterable = arange(23)
>>> [pair async for pair in apairwise(aiterable)]
[(0, 1), (1, 2), (2, 3), ..., (20, 21), (21, 22)]