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
e9b1bf47
Commit
e9b1bf47
authored
Mar 20, 2005
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Describe various things
parent
31a58df5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
6 deletions
+44
-6
Doc/whatsnew/whatsnew25.tex
Doc/whatsnew/whatsnew25.tex
+44
-6
No files found.
Doc/whatsnew/whatsnew25.tex
View file @
e9b1bf47
...
...
@@ -41,7 +41,7 @@ language.
\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
argument for
\
method
{
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.
...
...
@@ -55,10 +55,17 @@ print max(L, key=len)
print max(L)
\end{verbatim}
% XXX also supported by heapq.nsmallest() and heapq.nlargest().
(Contributed by Steven Bethard and Raymond Hettinger.)
\item
The list of base classes in a class definition can now be empty.
As an example, this is now legal:
\begin{verbatim}
class C():
pass
\end{verbatim}
(Implemented by Brett Cannon.)
\end{itemize}
...
...
@@ -95,17 +102,48 @@ details.
% datetime.datetime() now has a strptime class method which can be used to
% create datetime object using a string and format.
\item
The
\function
{
nsmallest()
}
and
\function
{
nlargest()
}
functions in the
\module
{
heapq
}
module
now support a
\code
{
key
}
keyword argument similar to the one
provided by the
\function
{
min()
}
/
\function
{
max()
}
functions
and the
\method
{
sort()
}
methods. For example:
Example:
\begin{verbatim}
>>> import heapq
>>> L = ["short", 'medium', 'longest', 'longer still']
>>> heapq.nsmallest(2, L) # Return two lowest elements, lexicographically
['longer still', 'longest']
>>> heapq.nsmallest(2, L, key=len) # Return two shortest elements
['short', 'medium']
\end{verbatim}
(Contributed by Raymond Hettinger.)
% itertools.islice() now accepts None for the start and step arguments.
\item
New module:
\module
{
spwd
}
provides functions for accessing the
shadow password database on systems that support it.
% XXX give example
% XXX os.stat_float_times is now True
\item
The
\module
{
os
}
module underwent a number of changes. The
\member
{
stat
_
float
_
times
}
variable now defaults to true, meaning that
\function
{
os.stat()
}
will now return time values as floats. (This
doesn't necessarily mean that
\function
{
os.stat()
}
will return times
that are precise to fractions of a second; not all systems support
such precision.)
Also, constants named
\member
{
os.SEEK
_
SET
}
,
\member
{
os.SEEK
_
CUR
}
, and
\member
{
os.SEEK
_
END
}
have been added; these are the parameters to the
\function
{
os.lseek()
}
function.
\item
The
\class
{
TarFile
}
class in the
\module
{
tarfile
}
module now has
a
\method
{
extractall()
}
method that extracts all members from the
archive into the current working directory. It's also possible to set
a different directory as the extraction target, and to unpack only a
subset of the archive's members. (Contributed by Lars Gust
\"
abel.)
% os.{SEEK_SET, SEEK_CUR, SEEK_END} have been added for convenience.
\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