Skip to content

gh-135676: Reword the f-string (and t-string) section #137469

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

Conversation

encukou
Copy link
Member

@encukou encukou commented Aug 6, 2025

Continuing from #135942, this tackles the f-string section.

Much of the information was duplicated in stdtypes.rst; this PR keeps lexical/syntactical details in Lexical Analysis and the evaluation & runtime behaviour in Standard types, with cross-references between the two.
Since the t-string section only listed differences from f-strings, and the grammar for the two is equivalent, that section was moved to Standard types almost entirely.


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

>>> f'{Fraction(1, 3)!s}'
For example::

>>> str(one_third)
Copy link
Member

Choose a reason for hiding this comment

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

These example are duplicated, how about merging it all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Where are they duplicated?

I'm showing the str() and repr() output (without f-strings) to remind readers how these work with Fraction. Without them, f'{one_third!s} is {one_third!r}' would make less sense.

@encukou encukou added the needs backport to 3.14 bugs and security fixes label Aug 13, 2025
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.

Update the grammar for f-strings on "Lexical analysis" page f-string documentation not fully accurate
2 participants