Skip to content

gh-136640: Clarify the documentation of the AST module #136868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-136640: clarify documentation of AST subclasses attributes
  • Loading branch information
Matthieu Lienart committed Jul 20, 2025
commit db02ddc75d27b8c5dde9595e5122a22b3f7c4a1b
11 changes: 6 additions & 5 deletions Doc/library/ast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ Node classes
end_lineno
end_col_offset

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

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy