aioplus.apairwise

aioplus.apairwise(aiterable, /)

Return successive overlapping pairs taken from the input aiterable.

Parameters:

aiterable (AsyncIterable of T) – An asynchronous iterable of elements to be paired.

Returns:

An asynchronous iterable yielding pairs of elements.

Return type:

AsyncIterable of tuple[T, T]

Examples

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