aioplus.areversed

aioplus.areversed(aiterable, /)

Return a reverse iterator.

Parameters:

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

Returns:

An asynchronous iterable yielding the objects in reverse order.

Return type:

AsyncIterable of T

Examples

>>> import asyncio
>>>
>>> from aioplus import arange, areversed
>>>
>>> async def main() -> None:
>>>     '''Run the program.'''
>>>     async for num in areversed(arange(2304)):
>>>         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

reversed()