aioplus.atriplewise

aioplus.atriplewise(aiterable, /)

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

Parameters:

aiterable (AsyncIterable[T]) – Iterable.

Returns:

Iterator.

Return type:

AsyncIterator[tuple[T, T, T]]

Examples

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