Discussion:
[Python-3000-checkins] r67188 - python/branches/py3k/Doc/library/functions.rst
benjamin.peterson
2008-11-11 21:43:43 UTC
Permalink
Author: benjamin.peterson
Date: Tue Nov 11 22:43:42 2008
New Revision: 67188

Log:
exec won't take file objects anymore

Modified:
python/branches/py3k/Doc/library/functions.rst

Modified: python/branches/py3k/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k/Doc/library/functions.rst (original)
+++ python/branches/py3k/Doc/library/functions.rst Tue Nov 11 22:43:42 2008
@@ -391,16 +391,15 @@

.. function:: exec(object[, globals[, locals]])

- This function supports dynamic execution of Python code. *object* must be 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, the
+ This function supports dynamic execution of Python code. *object* must be
+ either a string 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 a code object, it is simply executed. In all cases, the
code that's executed is expected to be valid as file input (see the section
- "File input" in the Reference Manual). Be aware that the :keyword:`return` and
- :keyword:`yield` statements may not be used outside of function definitions even
- within the context of code passed to the :func:`exec` function. The return value
- is ``None``.
+ "File input" in the Reference Manual). Be aware that the :keyword:`return`
+ and :keyword:`yield` statements may not be used outside of function
+ definitions even within the context of code passed to the :func:`exec`
+ function. The return value is ``None``.

In all cases, if the optional parts are omitted, the code is executed in the
current scope. If only *globals* is provided, it must be a dictionary, which
Loading...