aioplus.amax

async aioplus.amax(aiterable, /, *, key=None, default=Sentinel.UNSET)

Return the largest item in aiterable.

Parameters:
  • aiterable (AsyncIterable[T]) – An asynchronous iterable of objects.

  • key (Callable[[T], SupportsRichComparison], optional) – A function that extracts a comparison key from each element in the iterable.

  • default (D, optional) – A default value to return if the iterable is empty.

Returns:

The largest item in the iterable or the default value.

Return type:

T or D

Examples

>>> aiterable = arange(23)
>>> await amax(aiterable)
22

See also

max()