summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-06-07 21:52:47 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-06-07 21:52:47 (GMT)
commitd348193ff2bbf8b007f9cabd7fc81ab3491464e3 (patch)
treef3066bb63c9403a7b8b3a6e6785c5852cc87262b /Doc
parent90a764c5ee81320c8bc764700c610190f5a94e2d (diff)
downloadcpython-d348193ff2bbf8b007f9cabd7fc81ab3491464e3.zip
cpython-d348193ff2bbf8b007f9cabd7fc81ab3491464e3.tar.gz
cpython-d348193ff2bbf8b007f9cabd7fc81ab3491464e3.tar.bz2
Add genexps to the glossary.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/tut/glossary.tex12
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/tut/glossary.tex b/Doc/tut/glossary.tex
index 38b4609..538c5ea 100644
--- a/Doc/tut/glossary.tex
+++ b/Doc/tut/glossary.tex
@@ -128,6 +128,18 @@ stopped at the {}\keyword{yield} keyword (returning the result) and is
resumed there when the next element is requested by calling the
\method{next()} method of the returned iterator.
+\index{generator expression}
+\item[generator expression]
+An expression that returns a generator. It looks like a normal expression
+followed by a \keyword{for} expression defining a loop variable, range, and
+an optional \keyword{if} expression. The combined expression generates
+values for an enclosing function:
+
+\begin{verbatim}
+>>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81
+285
+\end{verbatim}
+
\index{GIL}
\item[GIL]
See \emph{global interpreter lock}.