Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3ddbf68a
Commit
3ddbf68a
authored
Jun 26, 1996
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
explain global better
parent
83d29c04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
Doc/ref/ref6.tex
Doc/ref/ref6.tex
+15
-2
Doc/ref6.tex
Doc/ref6.tex
+15
-2
No files found.
Doc/ref/ref6.tex
View file @
3ddbf68a
...
...
@@ -481,14 +481,14 @@ global_stmt: "global" identifier ("," identifier)*
\end{verbatim}
The
\verb
@
global
@
statement is a declaration which holds for the
entire current
scope
. It means that the listed identifiers are to be
entire current
code block
. It means that the listed identifiers are to be
interpreted as globals. While
{
\em
using
}
global names is automatic
if they are not defined in the local scope,
{
\em
assigning
}
to global
names would be impossible without
\verb
@
global
@
.
\indexiii
{
global
}{
name
}{
binding
}
Names listed in a
\verb
@
global
@
statement must not be used in the same
scope
before that
\verb
@
global
@
statement is executed.
code block
before that
\verb
@
global
@
statement is executed.
Names listed in a
\verb
@
global
@
statement must not be defined as formal
parameters or in a
\verb
@
for
@
loop control target,
\verb
@
class
@
...
...
@@ -499,6 +499,19 @@ restrictions, but programs should not abuse this freedom, as future
implementations may enforce them or silently change the meaning of the
program.)
Note: the
\verb
@
global
@
is a directive to the parser. Therefore, it
applies only to code parsed at the same time as the
\verb
@
global
@
statement. In particular, a
\verb
@
global
@
statement contained in an
\verb
@
exec
@
statement does not affect the code block
{
\em
containing
}
the
\verb
@
exec
@
statement, and code contained in an
\verb
@
exec
@
statement is unaffected by
\verb
@
global
@
statements in the code
containing the
\verb
@
exec
@
statement. The same applies to the
\verb
@
eval()
@
,
\verb
@
execfie()
@
and
\verb
@
compile()
@
functions.
\stindex
{
exec
}
\ttindex
{
eval
}
\ttindex
{
execfile
}
\ttindex
{
compile
}
\section
{
The
{
\tt
access
}
statement
}
\label
{
access
}
\stindex
{
access
}
...
...
Doc/ref6.tex
View file @
3ddbf68a
...
...
@@ -481,14 +481,14 @@ global_stmt: "global" identifier ("," identifier)*
\end{verbatim}
The
\verb
@
global
@
statement is a declaration which holds for the
entire current
scope
. It means that the listed identifiers are to be
entire current
code block
. It means that the listed identifiers are to be
interpreted as globals. While
{
\em
using
}
global names is automatic
if they are not defined in the local scope,
{
\em
assigning
}
to global
names would be impossible without
\verb
@
global
@
.
\indexiii
{
global
}{
name
}{
binding
}
Names listed in a
\verb
@
global
@
statement must not be used in the same
scope
before that
\verb
@
global
@
statement is executed.
code block
before that
\verb
@
global
@
statement is executed.
Names listed in a
\verb
@
global
@
statement must not be defined as formal
parameters or in a
\verb
@
for
@
loop control target,
\verb
@
class
@
...
...
@@ -499,6 +499,19 @@ restrictions, but programs should not abuse this freedom, as future
implementations may enforce them or silently change the meaning of the
program.)
Note: the
\verb
@
global
@
is a directive to the parser. Therefore, it
applies only to code parsed at the same time as the
\verb
@
global
@
statement. In particular, a
\verb
@
global
@
statement contained in an
\verb
@
exec
@
statement does not affect the code block
{
\em
containing
}
the
\verb
@
exec
@
statement, and code contained in an
\verb
@
exec
@
statement is unaffected by
\verb
@
global
@
statements in the code
containing the
\verb
@
exec
@
statement. The same applies to the
\verb
@
eval()
@
,
\verb
@
execfie()
@
and
\verb
@
compile()
@
functions.
\stindex
{
exec
}
\ttindex
{
eval
}
\ttindex
{
execfile
}
\ttindex
{
compile
}
\section
{
The
{
\tt
access
}
statement
}
\label
{
access
}
\stindex
{
access
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment