mirror of
https://github.com/python/cpython.git
synced 2025-10-01 12:52:18 +00:00
ast docs: Fix description of ast.Constant (#134741)
Contrary to the current docs, ast.Constant will never hold containers such as frozenset or tuple; the Python parser only emits it for simple literals. For precision, add the exact list of types that may be contained in an ast.Constant.
This commit is contained in:
parent
a4251411a9
commit
381020d41f
1 changed files with 3 additions and 3 deletions
|
@ -268,9 +268,9 @@ Literals
|
||||||
.. class:: Constant(value)
|
.. class:: Constant(value)
|
||||||
|
|
||||||
A constant value. The ``value`` attribute of the ``Constant`` literal contains the
|
A constant value. The ``value`` attribute of the ``Constant`` literal contains the
|
||||||
Python object it represents. The values represented can be simple types
|
Python object it represents. The values represented can be instances of :class:`str`,
|
||||||
such as a number, string or ``None``, but also immutable container types
|
:class:`bytes`, :class:`int`, :class:`float`, :class:`complex`, and :class:`bool`,
|
||||||
(tuples and frozensets) if all of their elements are constant.
|
and the constants :data:`None` and :data:`Ellipsis`.
|
||||||
|
|
||||||
.. doctest::
|
.. doctest::
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue