aioplus.aislice¶
- aioplus.aislice(aiterable, start, stop=None, step=None, /)¶
Return selected elements from the iterable.
- Parameters:
aiterable (AsyncIterable of T) – An asynchronous iterable of objects to slice.
start (int) – The index of the first object to include. If
stopisNone, treated as the end index, and slicing starts from0.stop (int, optional) – The index at which to stop (exclusive). If not provided,
startis interpreted asstop, and slicing starts from0.step (int, optional) – The difference between consecutive values. Defaults to
1.
- Returns:
An asynchronous iterable yielding selected objects according to the slice parameters.
- Return type:
AsyncIterable of T
Examples
>>> aiterable = arange(2003) >>> [num async for num in aislice(aiterable, 4, 23)] [4, 5, 6, 7, 8, ..., 20, 21, 22]
See also