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
>>> import asyncio >>> >>> from aioplus import apairwise, arange >>> >>> async def main() -> None: >>> '''Run the program.''' >>> async for left, right in apairwise(arange(23)): >>> print(f'pair = ({left}, {right})') >>> >>> if __name__ == '__main__': >>> asyncio.run(main())
See also