global_stmt: "global" identifier ("," identifier)*
The global
statement is a declaration which holds for the
entire current scope. It means that the listed identifiers are to be
interpreted as globals. While using global names is automatic
if they are not defined in the local scope, assigning to global
names would be impossible without global
.
Names listed in a global
statement must not be used in the same
scope before that global
statement is executed.
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.
(The current implementation does not enforce the latter two restrictions, but programs should not abuse this freedom, as future implementations may enforce them or silently change the meaning of the program.)