mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
SF patch #1077353: add key= argument to min and max
(First draft of patch contributed by Steven Bethard.)
This commit is contained in:
parent
e8fdc4502f
commit
3b0c7c20a1
5 changed files with 164 additions and 45 deletions
|
@ -642,16 +642,28 @@ class C:
|
|||
of sequence; the result is always a list.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{max}{s\optional{, args...}}
|
||||
\begin{funcdesc}{max}{s\optional{, args...}\optional{key}}
|
||||
With a single argument \var{s}, return the largest item of a
|
||||
non-empty sequence (such as a string, tuple or list). With more
|
||||
than one argument, return the largest of the arguments.
|
||||
|
||||
The optional \var{key} argument specifies a one argument ordering
|
||||
function like that used for \method{list.sort()}. The \var{key}
|
||||
argument, if supplied, must be in keyword form (for example,
|
||||
\samp{max(a,b,c,key=func)}).
|
||||
\versionchanged[Added support for the optional \var{key} argument]{2.5}
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{min}{s\optional{, args...}}
|
||||
With a single argument \var{s}, return the smallest item of a
|
||||
non-empty sequence (such as a string, tuple or list). With more
|
||||
than one argument, return the smallest of the arguments.
|
||||
|
||||
The optional \var{key} argument specifies a one argument ordering
|
||||
function like that used for \method{list.sort()}. The \var{key}
|
||||
argument, if supplied, must be in keyword form (for example,
|
||||
\samp{min(a,b,c,key=func)}).
|
||||
\versionchanged[Added support for the optional \var{key} argument]{2.5}
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{object}{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue