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
38dc2a6b
Commit
38dc2a6b
authored
Aug 07, 2004
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify language
parent
ac642875
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
Doc/whatsnew/whatsnew24.tex
Doc/whatsnew/whatsnew24.tex
+9
-11
No files found.
Doc/whatsnew/whatsnew24.tex
View file @
38dc2a6b
...
...
@@ -119,16 +119,13 @@ Kalle Svensson.}
%======================================================================
\section
{
PEP 289: Generator Expressions
}
The iterator feature introduced in Python 2.2 makes it easier to write
programs that loop through large data sets without having the entire
data set in memory at one time. Programmers can use iterators and the
\module
{
itertools
}
module to write code in a fairly functional style.
% XXX avoid metaphor
List comprehensions have been the fly in the ointment because they
produce a Python list object containing all of the items, unavoidably
pulling them all into memory. When trying to write a
functionally-styled program, it would be natural to write something
The iterator feature introduced in Python 2.2 and the
\module
{
itertools
}
module make it easier to write programs that loop
through large data sets without having the entire data set in memory
at one time. List comprehensions don't fit into this picture very
well because they produce a Python list object containing all of the
items, unavoidably pulling them all into memory. When trying to write
a functionally-styled program, it would be natural to write something
like:
\begin{verbatim}
...
...
@@ -148,7 +145,8 @@ for link in get_all_links():
The first form is more concise and perhaps more readable, but if
you're dealing with a large number of link objects the second form
would have to be used.
would have to be used to avoid having all link objects in memory at
the same time.
Generator expressions work similarly to list comprehensions but don't
materialize the entire list; instead they create a generator that will
...
...
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