[New-bugs-announce] [issue14544] Limit "global" keyword name conflicts in language spec to those enforced by CPython

Nick Coghlan 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 [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

----------
messages: 158005
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Limit "global" keyword name conflicts in language spec to those enforced by CPython
type: enhancement
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14544>
_______________________________________


More information about the New-bugs-announce mailing list