(original) (raw)
--- functions.rst.orig 2010-09-08 20:12:37.000000000 +0100 +++ functions.rst 2010-09-12 13:40:13.000000000 +0100 @@ -684,6 +684,10 @@ used for :meth:`list.sort`. The *key* argument, if supplied, must be in keyword form (for example, ``max(a,b,c,key=func)``). + When the iterable is not empty, max(iterable, key=key) is equivalent to + ``sorted(iterable, key=key, reverse=True)[0]``. That is, if there are items + with equal keys, the first such item is returned. + .. versionchanged:: 2.5 Added support for the optional *key* argument. @@ -698,6 +702,10 @@ used for :meth:`list.sort`. The *key* argument, if supplied, must be in keyword form (for example, ``min(a,b,c,key=func)``). + When the iterable is not empty, max(iterable, key=key) is equivalent to + ``sorted(iterable, key=key)[0]``. That is, if there are items with equal keys, + the first such item is returned. + .. versionchanged:: 2.5 Added support for the optional *key* argument.