mirror of
https://github.com/python/cpython.git
synced 2025-11-27 05:44:16 +00:00
#3569: eval() also accepts "exec"able code objects.
This commit is contained in:
parent
c176814d82
commit
6140651d93
1 changed files with 4 additions and 4 deletions
|
|
@ -381,10 +381,10 @@ available. They are listed here in alphabetical order.
|
||||||
>>> print eval('x+1')
|
>>> print eval('x+1')
|
||||||
2
|
2
|
||||||
|
|
||||||
This function can also be used to execute arbitrary code objects (such as those
|
This function can also be used to execute arbitrary code objects (such as
|
||||||
created by :func:`compile`). In this case pass a code object instead of a
|
those created by :func:`compile`). In this case pass a code object instead
|
||||||
string. The code object must have been compiled passing ``'eval'`` as the
|
of a string. If the code object has been compiled with ``'exec'`` as the
|
||||||
*kind* argument.
|
*kind* argument, :func:`eval`\'s return value will be ``None``.
|
||||||
|
|
||||||
Hints: dynamic execution of statements is supported by the :keyword:`exec`
|
Hints: dynamic execution of statements is supported by the :keyword:`exec`
|
||||||
statement. Execution of statements from a file is supported by the
|
statement. Execution of statements from a file is supported by the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue