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

>>> aiterable = arange(4, 23)
>>> [(index, num) async for index, num in aenumerate(aiterable)]
[(0, 4), (1, 5), (2, 6), (3, 7), ..., (17, 21), (18, 22)]

See also

enumerate()