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
7a6d297b
Commit
7a6d297b
authored
21 years ago
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Note list optimizations
* Move an example out of a comment.
parent
cb3e580e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
Doc/whatsnew/whatsnew24.tex
Doc/whatsnew/whatsnew24.tex
+14
-13
No files found.
Doc/whatsnew/whatsnew24.tex
View file @
7a6d297b
...
...
@@ -143,19 +143,11 @@ works like the \method{split()} method but splits from the end of
the string.
\begin{verbatim}
>>> 'a b c'.split(None, 1)
['a', 'b c']
>>> 'a b c'.rsplit(None, 1)
['a b', 'c']
\end{verbatim}
% Consider replacing the above example with one that is less
% abstract and more suggestive of why the function is useful:
%
% >>> 'www.python.org'.split('.', 1)
% ['www', 'python.org']
% >>> 'www.python.org'.rsplit('.', 1)
% ['www.python', 'org']
>>> 'www.python.org'.split('.', 1)
['www', 'python.org']
'www.python.org'.rsplit('.', 1)
['www.python', 'org']
\end{verbatim}
\item
The
\method
{
sort()
}
method of lists gained three keyword
arguments,
\var
{
cmp
}
,
\var
{
key
}
, and
\var
{
reverse
}
. These arguments
...
...
@@ -267,6 +259,15 @@ yellow 5
\begin{itemize}
\item
The machinery for growing and shrinking lists was optimized
for speed and for space efficiency. Small lists (under six bytes)
never over-allocate by more than one byte. Large lists do not
over-allocate by more than 1/8th. Appending and popping from lists
now runs faster due to more efficient code paths and less frequent
use of the underlying system realloc(). List comprehensions also
benefit. The amount of improvement varies between systems and shows
the greatest improvement on systems with poor realloc() implementations.
\item
\function
{
list()
}
,
\function
{
tuple()
}
,
\function
{
map()
}
,
\function
{
filter()
}
, and
\function
{
zip()
}
now run several times
faster with non-sequence arguments that supply a
\method
{__
len
__
()
}
...
...
This diff is collapsed.
Click to expand it.
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