Skip to content

Commit 98e601c

Browse files
author
Yuki Kobayashi
committed
Add note about type_comments parameter
1 parent c67ea98 commit 98e601c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Doc/library/ast.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,8 +1770,6 @@ Type annotations
17701770
A ``# type: ignore`` comment located at *lineno*.
17711771
*tag* is the optional tag specified by the form ``# type: ignore <tag>``.
17721772

1773-
See :func:`ast.parse` for more details.
1774-
17751773
.. doctest::
17761774

17771775
>>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), indent=4))
@@ -1794,6 +1792,10 @@ Type annotations
17941792
type_ignores=[
17951793
TypeIgnore(lineno=1, tag='[assignment]')])
17961794

1795+
.. note::
1796+
:class:`!TypeIgnore` nodes are not generated when the *type_comments* parameter
1797+
is set to ``False`` (default). See :func:`ast.parse` for more details.
1798+
17971799
.. versionadded:: 3.8
17981800

17991801
.. _ast-type-params:

0 commit comments

Comments
 (0)