aioplus.anth¶
- async aioplus.anth(aiterable, /, *, n, default=Sentinel.UNSET)¶
Return the nth item or a default value.
- Parameters:
aiterable (AsyncIterable[T]) – An asynchronous iterable to retrieve the nth item from.
n (int) – The index of the item to retrieve, starting from 0.
default (D, optional) – A default value to return if the nth item does not exist. If not provided,
IndexErrorwill be raised if the nth item is not found.
- Returns:
The nth item or the default value.
- Return type:
T or D
Examples
>>> aiterable = arange(23) >>> await anth(aiterable, n=4) 4