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
a75d306e
Commit
a75d306e
authored
Oct 18, 1993
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"exec" is now a statement. execfile() is obsolete.
(Also added a stub for "access".)
parent
db3165e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
Doc/ref/ref6.tex
Doc/ref/ref6.tex
+39
-0
Doc/ref6.tex
Doc/ref6.tex
+39
-0
No files found.
Doc/ref/ref6.tex
View file @
a75d306e
...
...
@@ -17,6 +17,8 @@ simple_stmt: expression_stmt
| continue
_
stmt
| import
_
stmt
| global
_
stmt
| access
_
stmt
| exec
_
stmt
\end{verbatim}
\section
{
Expression statements
}
...
...
@@ -466,3 +468,40 @@ definition, function definition, or \verb\import\ statement.
restrictions, but programs should not abuse this freedom, as future
implementations may enforce them or silently change the meaning of the
program.)
\section
{
The
{
\tt
access
}
statement
}
\label
{
access
}
\stindex
{
access
}
\begin{verbatim}
access
_
stmt: "access" ...
\end{verbatim}
This statement will be used in the future to control access to
instance and class variables. Currently its syntax and effects are
undefined; however the keyword
\verb
\
access
\
is a reserved word for
the parser.
\section
{
The
{
\tt
exec
}
statement
}
\label
{
exec
}
\stindex
{
exec
}
\begin{verbatim}
exec
_
stmt: "exec" expression ["in" expression ["," expression]]
\end{verbatim}
This statement supports dynamic execution of Python code. The first
expression should evaluate to either a string, an open file object, or
a code object. If it is a string, the string is parsed as a suite of
Python statements which is then executed (unless a syntax error
occurs). If it is an open file, the file is parsed until EOF and
executed. If it is a code object, it is simply executed.
In all cases, if the optional parts are omitted, the code is executed
in the current scope. If only the first expression after
\verb
\
in
\
is
specified, it should be a dictionary, which will be used for both the
global and the local variables. If two expressions are given, both
must be dictionaries and they are used for the global and local
variables, respectively.
Note: dynamic evaluation of expressions is supported by the built-in
function
\verb
\
eval
\
.
Doc/ref6.tex
View file @
a75d306e
...
...
@@ -17,6 +17,8 @@ simple_stmt: expression_stmt
| continue
_
stmt
| import
_
stmt
| global
_
stmt
| access
_
stmt
| exec
_
stmt
\end{verbatim}
\section
{
Expression statements
}
...
...
@@ -466,3 +468,40 @@ definition, function definition, or \verb\import\ statement.
restrictions, but programs should not abuse this freedom, as future
implementations may enforce them or silently change the meaning of the
program.)
\section
{
The
{
\tt
access
}
statement
}
\label
{
access
}
\stindex
{
access
}
\begin{verbatim}
access
_
stmt: "access" ...
\end{verbatim}
This statement will be used in the future to control access to
instance and class variables. Currently its syntax and effects are
undefined; however the keyword
\verb
\
access
\
is a reserved word for
the parser.
\section
{
The
{
\tt
exec
}
statement
}
\label
{
exec
}
\stindex
{
exec
}
\begin{verbatim}
exec
_
stmt: "exec" expression ["in" expression ["," expression]]
\end{verbatim}
This statement supports dynamic execution of Python code. The first
expression should evaluate to either a string, an open file object, or
a code object. If it is a string, the string is parsed as a suite of
Python statements which is then executed (unless a syntax error
occurs). If it is an open file, the file is parsed until EOF and
executed. If it is a code object, it is simply executed.
In all cases, if the optional parts are omitted, the code is executed
in the current scope. If only the first expression after
\verb
\
in
\
is
specified, it should be a dictionary, which will be used for both the
global and the local variables. If two expressions are given, both
must be dictionaries and they are used for the global and local
variables, respectively.
Note: dynamic evaluation of expressions is supported by the built-in
function
\verb
\
eval
\
.
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