Skip to content

gh-135676: Reword the Operators & Delimiters section(s) #137713

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 4 commits into
base: main
Choose a base branch
from

Conversation

encukou
Copy link
Member

@encukou encukou commented Aug 13, 2025

Lexically, there is no difference between operators and delimiters, so I combined the section.

This section also serves as a kind of guide for what all the ASCII "symbol" characters do, with notes like “The period can also occur in floating-point and imaginary literals” and “The following printing ASCII characters are not used in Python”.
I've expanded the notes to include @, {, etc., but (for now) stopped short of adding a table of ASCII characters with links to where they appear.

The tables of symbols are reorganized slightly.
. was added to operators (like @, it can be either operator or delimiter).
-> was moved from augmented assignment to delimiters.


📚 Documentation preview 📚: https://cpython-previews--137713.org.readthedocs.build/

encukou and others added 4 commits August 13, 2025 16:38
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Comment on lines +1378 to +1379
The following tokens are :dfn:`delimiters` -- simple tokens that
are not operators:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are lots of (simple) tokens that are not operators. Perhaps:

Suggested change
The following tokens are :dfn:`delimiters` -- simple tokens that
are not operators:
The following tokens are :dfn:`delimiters` -- simple tokens that
separate expressions:

Comment on lines +1387 to +1391
The period (``.``) and at-sign (``@``) can serve either as operators
or delimiters.

The period can also occur in :ref:`floating-point <floating>` and
:ref:`imaginary` literals.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be clearer?

Suggested change
The period (``.``) and at-sign (``@``) can serve either as operators
or delimiters.
The period can also occur in :ref:`floating-point <floating>` and
:ref:`imaginary` literals.
The at-sign (``@``) can serve as an operator or delimiter.
The period (``.``) may be an operator, a delimiter, or contained in
:ref:`floating-point <floating>` and :ref:`imaginary` literals.

Comment on lines +1399 to +1400
A sequence of three periods (without whitespace between them) has a special
meaning as an :py:data:`Ellipsis` literal:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A sequence of three periods (without whitespace between them) has a special
meaning as an :py:data:`Ellipsis` literal:
A sequence of three consecutive periods has a special meaning as an
:py:data:`Ellipsis` literal:

Comment on lines 1418 to 1419
The following printing ASCII characters have special meaning as part of other
tokens or are otherwise significant to the lexical analyzer:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The characters in this section (', ", #, \) have all been previously covered, does it make sense to keep the section?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review docs Documentation in the Doc dir needs backport to 3.14 bugs and security fixes skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants