aioplus.acycle¶
- aioplus.acycle(aiterable, /)¶
Make an iterator returning elements from the
aiterableand saving a copy of each.- Parameters:
aiterable (AsyncIterable of T) – An asynchronous iterable of elements to be cycled.
- Returns:
An asynchronous iterable yielding elements from the input iterable.
- Return type:
AsyncIterable of T
Examples
>>> import asyncio >>> >>> from aioplus import acycle, arange >>> >>> async def main() -> None: >>> '''Run the program.''' >>> async for num in acycle(arange(23)): >>> print(num) >>> >>> if __name__ == '__main__': >>> asyncio.run(main())
Notes
Entire iterable is buffered in memory before yielding results;
Yields control to the event loop before producing each value.
See also