Message158005
The language spec currently includes the following paragraph [1]:
Names listed in a global statement must not be defined as
formal parameters or in a for loop control target, class
definition, function definition, or import statement.
While the first restriction is real (and enforced by CPython), since formal parameters are explicitly defined as local variables, there's no obvious rationale for the last 4 restrictions (and CPython doesn't enforce any of them).
The proposal is that the paragraph be simplified to:
Names listed in a global statement must not also be defined as
formal function parameters. Attempting to do so raises SyntaxError.
The current (incorrect!) CPython implementation detail note will be removed.
A similar clarification will also be made in the "nonlocal" statement documentation.
[1] http://docs.python.org/dev/reference/simple_stmts.html#the-global-statement |
|
Date |
User |
Action |
Args |
2012-04-11 04:46:31 | ncoghlan | set | recipients:
+ ncoghlan |
2012-04-11 04:46:31 | ncoghlan | set | messageid: <1334119591.44.0.0449104949206.issue14544@psf.upfronthosting.co.za> |
2012-04-11 04:46:30 | ncoghlan | link | issue14544 messages |
2012-04-11 04:46:30 | ncoghlan | create | |
|