[Python-checkins] r60051 - python/trunk/Doc/reference/executionmodel.rst
georg.brandl
python-checkins at python.org
Fri Jan 18 17:42:57 CET 2008
Author: georg.brandl
Date: Fri Jan 18 17:42:57 2008
New Revision: 60051
Modified:
python/trunk/Doc/reference/executionmodel.rst
Log:
Note that genexps are function scopes too and therefore won't see class attributes.
Modified: python/trunk/Doc/reference/executionmodel.rst
==============================================================================
--- python/trunk/Doc/reference/executionmodel.rst (original)
+++ python/trunk/Doc/reference/executionmodel.rst Fri Jan 18 17:42:57 2008
@@ -52,7 +52,13 @@
definition occurs in a function block, the scope extends to any blocks contained
within the defining one, unless a contained block introduces a different binding
for the name. The scope of names defined in a class block is limited to the
-class block; it does not extend to the code blocks of methods.
+class block; it does not extend to the code blocks of methods -- this includes
+generator expressions since they are implemented using a function scope. This
+means that the following will fail::
+
+ class A:
+ a = 42
+ b = list(a + i for i in range(10))
.. index:: single: environment
More information about the Python-checkins
mailing list