New submission from Ivan Levkivskyi:
The documentation at https://docs.python.org/3/reference/simple_stmts.html says
that:
"Names listed in a global statement must not be used in the same code block
textually preceding that global statement"
But then later:
"CPython implementation detail: The current implementation does not enforce the
two restrictions,
but programs should not abuse this freedom, as future implementations may
enforce them..."
Code like this
def f():
x = 1
global x
gives SyntaxWarning for several releases, maybe it is time to make it a
SyntaxError?
----------
assignee: docs@python
components: Documentation, Interpreter Core
messages: 274813
nosy: docs@python, gvanrossum, levkivskyi
priority: normal
severity: normal
status: open
title: Make "global after use" a SyntaxError
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue27999>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com