aioplus.aenumerate

aioplus.aenumerate(aiterable, /, start=0)

Return an enumerated iterator.

Parameters:
  • aiterable (AsyncIterable of T) – An asynchronous iterable of objects to enumerate.

  • start (int, default 0) – The starting index. Must be an object supporting object.__index__().

Returns:

An asynchronous iterable yielding pairs of the form (index, object).

Return type:

AsyncIterable of tuple[int, T]

Examples

>>> import asyncio
>>>
>>> from aioplus import aenumerate, arange
>>>
>>> async def main() -> None:
>>>     '''Run the program.'''
>>>     async for index, num in aenumerate(arange(2304)):
>>>         print(index, num)
>>>
>>> if __name__ == '__main__':
>>>     asyncio.run(main())

See also

enumerate()