GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-135676: Reword the f-string (and t-string) section by encukou · Pull Request #137469 · python/cpython

Conversation

@encukou

@encukou encukou commented Aug 6, 2025 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

  • Issue: Reword the Lexical Analysis chapter of the docs #135676

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
encukou and others added 18 commits June 25, 2025 16:27
@encukou @blaisep
WIP: String literals
d4381aa
Co-authored-by: Blaise Pabon <[email protected]>
@encukou
Use correct Pygments lexer for plain text
80ad85c
@encukou
WIP
e44fa66
@encukou
More WIP
86bf94b
@encukou
Byte strings, raw strings; f-string stub
faf05a1
@encukou
Remove outdated comment
687fe58
@encukou
Fix ReST errors
9f9d29c
@encukou
TMP
1e0c84a
@encukou
Continue with f-strings
e7b57b5
@encukou
Merge in the main branch
3733e0c
@encukou
Work on the f-string semantics
d593940
@encukou
Work on f-strings
0d8a917
@encukou
Merge in the main branch
366ecfc
@encukou @AA-Turner @blaisep
Details & start on the formal grammar
5fdb129
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Blaise Pabon <[email protected]>
@encukou
Improve text on whitespace in f-string debug expressions
e88843c
@encukou
Merge in the main branch
394f835
@encukou
Comment on the funkiness of the t-string grammar
f2db8f9
@encukou
Adjust t-string docs: move evaluation rules out, add a note on grammar
6468a97
@encukou
encukou requested review from AA-Turner and willingc as code owners August 6, 2025 15:20
@bedevere-app bedevere-app Bot added awaiting core review docs Documentation in the Doc dir skip news labels Aug 6, 2025
@github-project-automation github-project-automation Bot added this to Docs PRs Aug 6, 2025
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Aug 6, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Aug 6, 2025
Reword the Lexical Analysis chapter of the docs #135676
Open
StanFromIreland
StanFromIreland reviewed Aug 6, 2025
View reviewed changes
Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

StanFromIreland
StanFromIreland reviewed Aug 6, 2025
View reviewed changes
Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/stdtypes.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@encukou encukou mentioned this pull request Aug 12, 2025
f-string documentation not fully accurate #81997
Closed
@StanFromIreland StanFromIreland linked an issue Aug 12, 2025 that may be closed by this pull request
f-string documentation not fully accurate #81997
Closed
@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting core review labels Oct 8, 2025
@bedevere-app

bedevere-app Bot commented Oct 8, 2025

Copy link
Copy Markdown

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!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou

encukou commented Oct 8, 2025

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ericvsmith

ericvsmith commented Oct 8, 2025

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou

encukou commented Oct 29, 2025

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou

encukou commented Nov 26, 2025

Copy link
Copy Markdown
Member Author

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

willingc reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

willingc
willingc reviewed Nov 26, 2025
View reviewed changes
Comment thread Doc/library/stdtypes.rst
>>> nationality = 'Spanish'
>>> f'The {nationality} Inquisition!'
'The Spanish Inquisition!'
Whitespace before, inside and after the expression, as well as whitespace

@willingc willingc Nov 26, 2025

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

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 {}.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@encukou encukou Nov 27, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@encukou
encukou dismissed AA-Turner’s stale review December 3, 2025 12:48

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

@bedevere-app bedevere-app Bot added awaiting review and removed awaiting changes labels Dec 3, 2025
@encukou
Merge branch 'main' into lex-analysis-fstrings
ebe2a6b
@encukou
encukou merged commit aea5531 into python:main Dec 3, 2025
28 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Dec 3, 2025
@miss-islington-app

miss-islington-app Bot commented Dec 3, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting review label Dec 3, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 3, 2025
@encukou @blaisep
@AA-Turner @StanFromIreland @miss-islington
pythongh-135676: Reword the f-string (and t-string) section (pythonGH…
1886791
…-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 <[email protected]>
Co-authored-by: Blaise Pabon <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>
@bedevere-app

bedevere-app Bot commented Dec 3, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Dec 3, 2025
@encukou encukou added the needs backport to 3.14 bugs and security fixes label Dec 3, 2025
@miss-islington-app

miss-islington-app Bot commented Dec 3, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 3, 2025
@encukou @blaisep
@AA-Turner @StanFromIreland @miss-islington
pythongh-135676: Reword the f-string (and t-string) section (pythonGH…
baa16b9
…-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 <[email protected]>
Co-authored-by: Blaise Pabon <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>
@miss-islington-app

miss-islington-app Bot commented Dec 3, 2025

Copy link
Copy Markdown

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app miss-islington-app Bot assigned encukou Dec 3, 2025
@StanFromIreland

StanFromIreland commented Dec 3, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland StanFromIreland 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
@encukou @blaisep
@AA-Turner @StanFromIreland
[3.14] pythongh-135676: Reword the f-string (and t-string) section (p…
dab6cb5
…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 <[email protected]>
Co-authored-by: Blaise Pabon <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>
@StanFromIreland

StanFromIreland commented Dec 3, 2025

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

encukou added a commit that referenced this pull request Dec 4, 2025
@miss-islington @encukou
@blaisep @AA-Turner @StanFromIreland
[3.14] gh-135676: Reword the f-string (and t-string) section (GH-137469…
5611e08
…) (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 <[email protected]>
Co-authored-by: Blaise Pabon <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
@encukou @blaisep
@AA-Turner @StanFromIreland
pythongh-135676: Reword the f-string (and t-string) section (pythonGH…
eb4688e
…-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 <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@willingc willingc willingc left review comments
@StanFromIreland StanFromIreland StanFromIreland left review comments
@AA-Turner AA-Turner AA-Turner left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@encukou encukou

Labels

docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Done

Milestone

No milestone

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

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@encukou @ericvsmith @StanFromIreland @willingc @AA-Turner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.