mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
comprehrensions now have proper scoping #5106
This commit is contained in:
parent
1010bf3e26
commit
e9deddbf8c
1 changed files with 2 additions and 2 deletions
|
|
@ -51,8 +51,8 @@ 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 -- this includes
|
||||
generator expressions since they are implemented using a function scope. This
|
||||
means that the following will fail::
|
||||
comprehensions and generator expressions since they are implemented using a
|
||||
function scope. This means that the following will fail::
|
||||
|
||||
class A:
|
||||
a = 42
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue