Skip to content

Commit db02ddc

Browse files
author
Matthieu Lienart
committed
gh-136640: clarify documentation of AST subclasses attributes
1 parent dda9d00 commit db02ddc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Doc/library/ast.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,12 @@ Node classes
9191
end_lineno
9292
end_col_offset
9393

94-
Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have
95-
:attr:`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and
96-
:attr:`end_col_offset` attributes. The :attr:`lineno` and :attr:`end_lineno`
97-
are the first and last line numbers of source text span (1-indexed so the
98-
first line is line 1) and the :attr:`col_offset` and :attr:`end_col_offset`
94+
Most instances of classes part of this module, e.g. instances of subclasses of
95+
:class:`ast.expr`, :class:`ast.stmt` and others (see
96+
`Abstract Grammar <abstract-grammar_>`__), have :attr:`lineno`, :attr:`col_offset`,
97+
:attr:`end_lineno`, and :attr:`end_col_offset` attributes. The :attr:`lineno` and
98+
:attr:`end_lineno` are the first and last line numbers of source text span (1-indexed
99+
so the first line is line 1) and the :attr:`col_offset` and :attr:`end_col_offset`
99100
are the corresponding UTF-8 byte offsets of the first and last tokens that
100101
generated the node. The UTF-8 offset is recorded because the parser uses
101102
UTF-8 internally.

0 commit comments

Comments
 (0)