summaryrefslogtreecommitdiffstats
path: root/Doc/reference/expressions.rst
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-03-04 23:39:23 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-03-04 23:39:23 (GMT)
commit7864476afa402a0537c33ba9630e77351720baf8 (patch)
treecb9113e14d6a0b56696398f4d61d107ea7055e08 /Doc/reference/expressions.rst
parent227c800f4397764a20b77fd58467e2bb27fbf510 (diff)
downloadcpython-7864476afa402a0537c33ba9630e77351720baf8.zip
cpython-7864476afa402a0537c33ba9630e77351720baf8.tar.gz
cpython-7864476afa402a0537c33ba9630e77351720baf8.tar.bz2
Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r61209 | georg.brandl | 2008-03-03 21:37:55 +0100 (Mon, 03 Mar 2008) | 2 lines There are now sixteen isfoo functions. ........ r61210 | georg.brandl | 2008-03-03 21:39:00 +0100 (Mon, 03 Mar 2008) | 2 lines 15 -> 16, the 2nd ........ r61211 | georg.brandl | 2008-03-03 22:22:47 +0100 (Mon, 03 Mar 2008) | 2 lines Actually import itertools. ........ r61212 | georg.brandl | 2008-03-03 22:31:50 +0100 (Mon, 03 Mar 2008) | 2 lines Expand a bit on genexp scopes. ........ r61213 | raymond.hettinger | 2008-03-03 23:04:55 +0100 (Mon, 03 Mar 2008) | 1 line Remove dependency on itertools -- a simple genexp suffices. ........ r61214 | raymond.hettinger | 2008-03-03 23:19:58 +0100 (Mon, 03 Mar 2008) | 1 line Issue 2226: Callable checked for the wrong abstract method. ........ r61217 | andrew.kuchling | 2008-03-04 01:40:32 +0100 (Tue, 04 Mar 2008) | 1 line Typo fix ........ r61218 | andrew.kuchling | 2008-03-04 02:30:10 +0100 (Tue, 04 Mar 2008) | 1 line Grammar fix; markup fix ........ r61219 | andrew.kuchling | 2008-03-04 02:47:38 +0100 (Tue, 04 Mar 2008) | 1 line Fix sentence fragment ........ r61220 | andrew.kuchling | 2008-03-04 02:48:26 +0100 (Tue, 04 Mar 2008) | 1 line Typo fix ........ r61221 | andrew.kuchling | 2008-03-04 02:49:37 +0100 (Tue, 04 Mar 2008) | 1 line Add versionadded tags ........ r61222 | andrew.kuchling | 2008-03-04 02:50:32 +0100 (Tue, 04 Mar 2008) | 1 line Thesis night results: add various items ........ r61224 | raymond.hettinger | 2008-03-04 05:17:08 +0100 (Tue, 04 Mar 2008) | 1 line Beef-up docs and tests for itertools. Fix-up end-case for product(). ........ r61225 | georg.brandl | 2008-03-04 08:25:54 +0100 (Tue, 04 Mar 2008) | 2 lines Fix some patch attributions. ........ r61226 | georg.brandl | 2008-03-04 08:33:30 +0100 (Tue, 04 Mar 2008) | 2 lines #2230: document that PyArg_* leaves addresses alone on error. ........ r61233 | neal.norwitz | 2008-03-04 17:22:46 +0100 (Tue, 04 Mar 2008) | 3 lines Close the file before trying to remove the directory so it works on Windows. As reported by Trent Nelson on python-dev. ........ r61234 | thomas.heller | 2008-03-04 21:09:11 +0100 (Tue, 04 Mar 2008) | 9 lines Merged changes from libffi3-branch. The bundled libffi copy is now in sync with the recently released libffi3.0.4 version, apart from some small changes to Modules/_ctypes/libffi/configure.ac. I gave up on using libffi3 files on os x. Instead, static configuration with files from pyobjc is used. ........ r61235 | thomas.heller | 2008-03-04 21:21:42 +0100 (Tue, 04 Mar 2008) | 1 line Try to fix the build for PY_LINUX. ........ r61236 | fred.drake | 2008-03-04 22:14:04 +0100 (Tue, 04 Mar 2008) | 2 lines fix typo ........ r61237 | raymond.hettinger | 2008-03-04 23:29:44 +0100 (Tue, 04 Mar 2008) | 1 line Fix refleak in chain(). ........
Diffstat (limited to 'Doc/reference/expressions.rst')
-rw-r--r--Doc/reference/expressions.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index e8efa9f..ac3c90f 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -232,6 +232,20 @@ and added to the set object. When a comprehension is supplied, the set is
constructed from the elements resulting from the comprehension.
+Variables used in the generator expression are evaluated lazily in a separate
+scope when the :meth:`next` method is called for the generator object (in the
+same fashion as for normal generators). However, the :keyword:`in` expression
+of the leftmost :keyword:`for` clause is immediately evaluated in the current
+scope so that an error produced by it can be seen before any other possible
+error in the code that handles the generator expression. Subsequent
+:keyword:`for` and :keyword:`if` clauses cannot be evaluated immediately since
+they may depend on the previous :keyword:`for` loop. For example:
+``(x*y for x in range(10) for y in bar(x))``.
+
+The parentheses can be omitted on calls with only one argument. See section
+:ref:`calls` for the detail.
+
+
.. _dict:
Dictionary displays