diff options
author | Georg Brandl <georg@python.org> | 2014-11-05 19:20:28 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-11-05 19:20:28 (GMT) |
commit | a1137fba8949d37da17f16c396a94e5df1e1f9b4 (patch) | |
tree | 84d2a689f90aec6bed7cab6c7f62495231d097bd | |
parent | 95805109583c8f1fc358f5f9c82098040b0bfa9e (diff) | |
download | cpython-a1137fba8949d37da17f16c396a94e5df1e1f9b4.zip cpython-a1137fba8949d37da17f16c396a94e5df1e1f9b4.tar.gz cpython-a1137fba8949d37da17f16c396a94e5df1e1f9b4.tar.bz2 |
Closes #22525: clarify documentation for ast.literal_eval().
-rw-r--r-- | Doc/library/ast.rst | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index 8adc88f..cf0c32e 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -132,12 +132,14 @@ and classes for traversing abstract syntax trees: .. function:: literal_eval(node_or_string) Safely evaluate an expression node or a Unicode or *Latin-1* encoded string - containing a Python expression. The string or node provided may only consist - of the following Python literal structures: strings, numbers, tuples, lists, - dicts, booleans, and ``None``. - - This can be used for safely evaluating strings containing Python expressions - from untrusted sources without the need to parse the values oneself. + containing a Python literal or container display. The string or node + provided may only consist of the following Python literal structures: + strings, numbers, tuples, lists, dicts, booleans, and ``None``. + + This can be used for safely evaluating strings containing Python values from + untrusted sources without the need to parse the values oneself. It is not + capable of evaluating arbitrarily complex expressions, for example involving + operators or indexing. .. function:: get_docstring(node, clean=True) |