Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1cae3f57
Commit
1cae3f57
authored
Dec 03, 2004
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AAdd item. (And so it beegins again.)
parent
92e2495a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
Doc/whatsnew/whatsnew25.tex
Doc/whatsnew/whatsnew25.tex
+18
-1
No files found.
Doc/whatsnew/whatsnew25.tex
View file @
1cae3f57
...
...
@@ -37,7 +37,24 @@ Here are all of the changes that Python 2.5 makes to the core Python
language.
\begin{itemize}
\item
TBD
\item
The
\function
{
min()
}
and
\function
{
max()
}
built-in functions
gained a
\code
{
key
}
keyword argument analogous to the
\code
{
key
}
argument for
\function
{
sort()
}
. This argument supplies a function
that takes a single argument and is called for every value in the list;
\function
{
min()
}
/
\function
{
max()
}
will return the element with the
smallest/largest return value from this function.
For example, to find the longest string in a list, you can do:
\begin{verbatim}
L = ['medium', 'longest', 'short']
# Prints 'longest'
print max(L, key=len)
# Prints 'short', because lexicographically 'short' has the largest value
print max(L)
\end{verbatim}
(Contributed by Steven Bethard and Raymond Hettinger.)
\end{itemize}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment