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
stopisNone, this argument is treated as the end value, and the sequence starts from0.stop (int, optional) – The end value of the sequence (exclusive). If not provided,
startis interpreted as the end and the sequence begins from0.step (int, optional) – The difference between consecutive values. Defaults to
1if not specified. May be negative to produce a decreasing sequence.
- Returns:
An asynchronous iterable yielding values from
starttostop, separated bystep.- Return type:
AsyncIterable of int
Examples
>>> import asyncio >>> >>> from aioplus import arange >>> >>> async def main() -> None: >>> '''Run the program.''' >>> async for num in arange(2304): >>> print(num) >>> >>> if __name__ == '__main__': >>> asyncio.run(main())
Notes
Yields control to the event loop before producing each value.
See also
range()