mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
The execfile() docs imply it acts on locals same as exec. But in truth
it acts more like assigning to keys in locals(), i.e. modifications to function locals aren't reflected in the locals when execfile() returns.
This commit is contained in:
parent
1c33daf143
commit
af5910f025
1 changed files with 7 additions and 0 deletions
|
@ -257,6 +257,13 @@ class instances are callable if they have a \method{__call__()} method.
|
|||
If both dictionaries are omitted, the expression is executed in the
|
||||
environment where \function{execfile()} is called. The return value is
|
||||
\code{None}.
|
||||
|
||||
\strong{Warning:} The default \var{locals} act as described for function
|
||||
\function{locals()} below: modifications to the default \var{locals}
|
||||
dictionary should not be attempted. Pass an explicit \var{locals}
|
||||
dictionary if you need to see effects of the code on \var{locals} after
|
||||
function \function{execfile()} returns. \function{execfile()} cannot
|
||||
be used reliably to modify a function's locals.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{file}{filename\optional{, mode\optional{, bufsize}}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue