diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-12 00:43:29 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-12 00:43:29 (GMT) |
commit | 016880229a369a3fb419f3eed28b6db7c342fe71 (patch) | |
tree | 9b11de5c197bc556dd515e035327673765cd4871 /Doc/lib/libfuncs.tex | |
parent | 41eaedd3613cebc83e6b9925499369992c7a7770 (diff) | |
download | cpython-016880229a369a3fb419f3eed28b6db7c342fe71.zip cpython-016880229a369a3fb419f3eed28b6db7c342fe71.tar.gz cpython-016880229a369a3fb419f3eed28b6db7c342fe71.tar.bz2 |
Kill execfile(), use exec() instead
Diffstat (limited to 'Doc/lib/libfuncs.tex')
-rw-r--r-- | Doc/lib/libfuncs.tex | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index 3cc06c8..0b99c3f 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -382,15 +382,13 @@ class C: compiled passing \code{'eval'} as the \var{kind} argument. Hints: dynamic execution of statements is supported by the - \function{exec()} function. Execution of statements from a file is - supported by the \function{execfile()} function. The + \function{exec()} function. The \function{globals()} and \function{locals()} functions returns the current global and local dictionary, respectively, which may be useful to pass around for use by \function{eval()} or - \function{execfile()}. + \function{exec()}. \end{funcdesc} - \begin{funcdesc}{exec}{object\optional{, globals\optional{, locals}}} This function supports dynamic execution of Python code. \var{object} must be either a string, an open file object, or @@ -425,31 +423,6 @@ class C: argument to \function{exec()}.} \end{funcdesc} -\begin{funcdesc}{execfile}{filename\optional{, globals\optional{, locals}}} - This function is similar to the \function{exec()} function, but parses a - file given by the file name instead of a string. It - is different from the \keyword{import} statement in that it does not - use the module administration --- it reads the file unconditionally - and does not create a new module. - - The arguments are a file name and two optional dictionaries. The file is - parsed and evaluated as a sequence of Python statements (similarly to a - module) using the \var{globals} and \var{locals} dictionaries as global and - local namespace. If provided, \var{locals} can be any mapping object. - \versionchanged[formerly \var{locals} was required to be a dictionary]{2.4} - If the \var{locals} dictionary is omitted it defaults to the \var{globals} - dictionary. If both dictionaries are omitted, the expression is executed in - the environment where \function{execfile()} is called. The return value is - \code{None}. - - \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}}} Constructor function for the \class{file} type, described further in section~\ref{bltin-file-objects}, ``\ulink{File |