You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ncoghlan opened this issue
Apr 11, 2012
· 4 comments
Labels
3.11only security fixes3.12bugs and security fixes3.13bugs and security fixesdocsDocumentation in the Doc direasytype-featureA feature request or enhancement
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2012-04-11.04:46:30.833>labels= ['type-feature']
title='Limit "global" keyword name conflicts in language spec to those enforced by CPython'updated_at=<Date2015-03-05.10:03:11.434>user='https://github.com/ncoghlan'
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.
This shouldn't be a problem for PyPy, in fact I'm almost positive that we implement this already (since Django has a test that uses this "feature"). If/when the spec is changed please make sure there are tests for all these cases so we *know* it works though.
3.11only security fixes3.12bugs and security fixes3.13bugs and security fixesdocsDocumentation in the Doc direasytype-featureA feature request or enhancement
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: