aioplus.atriplewise

aioplus.atriplewise(aiterable, /)

Return successive overlapping triplets taken from the input aiterable.

Parameters:

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

Returns:

An asynchronous iterable yielding triplets of elements.

Return type:

AsyncIterable of tuple[T, T, T]

Examples

>>> import asyncio
>>>
>>> from aioplus import arange, atriplewise
>>>
>>> async def main() -> None:
>>>     '''Run the program.'''
>>>     async for left, middle, right in atriplewise(arange(23)):
>>>         print(f'triplet = ({left}, {middle}, {right})')
>>>
>>> if __name__ == '__main__':
>>>     asyncio.run(main())