Skip to content

Commit 29192fa

Browse files
author
rhettinger
committed
Add genexps to the glossary.
git-svn-id: http://svn.python.org/projects/python/trunk@36118 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 283116b commit 29192fa

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Doc/tut/glossary.tex

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,18 @@ \chapter{Glossary\label{glossary}}
128128
resumed there when the next element is requested by calling the
129129
\method{next()} method of the returned iterator.
130130

131+
\index{generator expression}
132+
\item[generator expression]
133+
An expression that returns a generator. It looks like a normal expression
134+
followed by a \keyword{for} expression defining a loop variable, range, and
135+
an optional \keyword{if} expression. The combined expression generates
136+
values for an enclosing function:
137+
138+
\begin{verbatim}
139+
>>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81
140+
285
141+
\end{verbatim}
142+
131143
\index{GIL}
132144
\item[GIL]
133145
See \emph{global interpreter lock}.

0 commit comments

Comments
 (0)