aioplus.anth

async aioplus.anth(aiterable, /, *, n, default=Ellipsis)

Return the n-th item of aiterable.

Parameters:
  • aiterable (AsyncIterable[T]) – Iterable.

  • n (int) – Index.

  • default (D, unset) – Default.

Returns:

Item.

Return type:

T | D

Notes

  • If aiterable[n] does not exist and default is unset, then IndexError is raised.

Examples

>>> aiterable = arange(23)
>>> await anth(aiterable, n=4)
4