[issue14544] Limit "global" keyword name conflicts in language spec to those enforced by CPython
report at bugs.python.org
Wed Apr 11 06:46:31 CEST 2012
New submission from Nick Coghlan <ncoghlan at gmail.com>:
The language spec currently includes the following paragraph :
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.
title: Limit "global" keyword name conflicts in language spec to those enforced by CPython
versions: Python 3.3
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list