@@ -87,16 +87,16 @@ \section{Built-in Functions}
8787 \code {(math.floor(\var {a} / \var {b}), \var {a} \% {} \var {b})}.
8888\end {funcdesc }
8989
90- \begin {funcdesc }{eval}{s \optional {\, globals\optional {\, locals}}}
90+ \begin {funcdesc }{eval}{expression \optional {\, globals\optional {\, locals}}}
9191 The arguments are a string and two optional dictionaries. The
92- string argument is parsed and evaluated as a Python expression
93- (technically speaking, a condition list) using the dictionaries as
94- global and local name space. The string must not contain null bytes
95- or newline characters. The return value is the
96- result of the expression. If the third argument is omitted it
97- defaults to the second. If both dictionaries are omitted, the
92+ \var {expression} argument is parsed and evaluated as a Python
93+ expression (technically speaking, a condition list) using the
94+ \var {globals} and \var {locals} dictionaries as global and local name
95+ space. If the \var {globals} dictionary is omitted it defaults to
96+ the \var {locals} dictionary. If both dictionaries are omitted, the
9897 expression is executed in the environment where \code {eval} is
99- called. Syntax errors are reported as exceptions. Example:
98+ called. The return value is the result of the evaluated expression.
99+ Syntax errors are reported as exceptions. Example:
100100
101101\bcode \begin {verbatim }
102102>>> x = 1
@@ -111,8 +111,26 @@ \section{Built-in Functions}
111111 passing \code {'eval'} to the \var {kind} argument.
112112
113113 Note: dynamic execution of statements is supported by the
114- \code {exec} statement.
115-
114+ \code {exec} statement. Execution of statements from a file is
115+ supported by the \code {execfile()} function.
116+
117+ \end {funcdesc }
118+
119+ \begin {funcdesc }{execfile}{file\optional {\, globals\optional {\, locals}}}
120+ This function is similar to the \code {eval()} function or the
121+ \code {exec} statement, but parses a file instead of a string. It is
122+ different from the \code {import} statement in that it does not use
123+ the module administration -- it reads the file unconditionally and
124+ does not create a new module.
125+
126+ The arguments are a file name and two optional dictionaries. The
127+ file is parsed and evaluated as a sequence of Python statements
128+ (similarly to a module) using the \var {globals} and \var {locals}
129+ dictionaries as global and local name space. If the \var {globals}
130+ dictionary is omitted it defaults to the \var {locals} dictionary.
131+ If both dictionaries are omitted, the expression is executed in the
132+ environment where \code {execfile} is called. The return value is
133+ None.
116134\end {funcdesc }
117135
118136\begin {funcdesc }{filter}{function\, list}
0 commit comments