aioplus.arange

aioplus.arange(start, stop=None, step=None, /)

Iterate over a range of integers.

Parameters:
  • start (int) – The starting value of the sequence (inclusive). If stop is None, this argument is treated as the end value, and the sequence starts from 0.

  • stop (int, optional) – The end value of the sequence (exclusive). If not provided, start is interpreted as the end and the sequence begins from 0.

  • step (int, optional) – The difference between consecutive values. Defaults to 1 if not specified. May be negative to produce a decreasing sequence.

Returns:

An asynchronous iterable yielding values from start to stop, separated by step.

Return type:

AsyncIterable of int

Examples

>>> [num async for num in arange(23)]
[0, 1, 2, 3, 4, ..., 19, 20, 21, 22]

Notes

  • Yields control to the event loop before producing each value.

See also

range()