Skip to content

Conversation

@encukou
Copy link
Member

@encukouencukou 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/

@StanFromIrelandStanFromIreland linked an issue Aug 12, 2025 that may be closed by this pull request
@bedevere-app
Copy link

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

And if you don't make the requested changes, you will be put in the comfy chair!

@encukou
Copy link
MemberAuthor

The question is: Does this PR bring the docs closer to the desired state? Would you be OK with basing your PR on this rather than the status quo?

I did try to move runtime stuff to stdtypes and lexical stuff to lexical_analysis, but yeah, this can always be improved.

@ericvsmith
Copy link
Member

This PR addresses #125496. I've closed that issue in preference to this one.

@encukou
Copy link
MemberAuthor

@AA-Turner: Would it make sense for you to work on top of this PR?

@encukou
Copy link
MemberAuthor

I plan to to merge this next week if there are no objections.

>>> nationality ='Spanish'
>>> f'The {nationality} Inquisition!'
'The Spanish Inquisition!'
Whitespace before, inside and after the expression, as well as whitespace
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps highlight a bit. I didn't realize that the whitespace was significant before and after within the{}.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Do you have a suggestion on how to highlight this?

FWIW, I don't think this is a very important detail, since it only affects formatting of debug output.

@encukouencukou dismissed AA-Turner’s stale reviewDecember 3, 2025 12:48

Let's not have the perfect be the enemy of the good. Follow-up PRs are always welcome.

@encukouencukou merged commit aea5531 into python:mainDec 3, 2025
28 checks passed
@github-project-automationgithub-project-automationbot moved this from Todo to Done in Docs PRsDec 3, 2025
@miss-islington-app
Copy link

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 3, 2025
…-137469) 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. (cherry picked from commit aea5531) Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Blaise Pabon <blaise@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@bedevere-app
Copy link

GH-142227 is a backport of this pull request to the 3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14 bugs and security fixes label Dec 3, 2025
@encukouencukou added the needs backport to 3.14 bugs and security fixes label Dec 3, 2025
@miss-islington-app
Copy link

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 3, 2025
…-137469) 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. (cherry picked from commit aea5531) Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Blaise Pabon <blaise@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@miss-islington-app
Copy link

Sorry @encukou, I had trouble completing the backport.
Please retry by removing and re-adding the "needs backport to 3.14" label.
Please backport backport using cherry_picker on the command line.

cherry_picker aea5531583aaa8bfdf3ebca914e9c694617c3489 3.14 

@StanFromIreland
Copy link
Member

StanFromIreland commented Dec 3, 2025

The fail must have due to the GH outage I heard about in the Discord, it successfully cherry-picked but failed to add the comment.

@StanFromIrelandStanFromIreland removed the needs backport to 3.14 bugs and security fixes label Dec 3, 2025
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Dec 3, 2025
…ythonGH-137469) 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. (cherry picked from commit aea5531) Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Blaise Pabon <blaise@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@StanFromIreland
Copy link
Member

GH-142227 is a backport of this pull request to the 3.14 branch.

encukou added a commit that referenced this pull request Dec 4, 2025
…) (GH-142227) 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. (cherry picked from commit aea5531) Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Blaise Pabon <blaise@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
…-137469) 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. Co-authored-by: Blaise Pabon <blaise@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docsDocumentation in the Doc dirskip news

Projects

Status: Done

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

5 participants

@encukou@ericvsmith@StanFromIreland@willingc@AA-Turner