Skip to content

gh-138558: Improve description of Interpolation.expression in library docs#139187

Merged
AA-Turner merged 8 commits into
python:mainfrom
davepeck:interpolation-doc-fix
Oct 4, 2025
Merged

gh-138558: Improve description of Interpolation.expression in library docs#139187
AA-Turner merged 8 commits into
python:mainfrom
davepeck:interpolation-doc-fix

Conversation

@davepeck

@davepeck davepeck commented Sep 20, 2025

Copy link
Copy Markdown
Contributor

Improve the description of Interpolation.expression to clarify exactly what it is set to, and when.

This is in response to Jelle's comment in this related issue.


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

@AA-Turner AA-Turner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some suggestions -- these will need wrapping though, sorry, I'm on mobile.

A

Comment thread Doc/library/string.templatelib.rst Outdated
should either set this to an empty string or choose a suitable valid
Python expression.
For interpolations created from t-string literals, :attr:`!expression`
is the source text found inside the curly braces, including any

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
is the source text found inside the curly braces, including any
is the source text found inside the curly brackets (``{`` & ``}``), including any

@davepeck davepeck Sep 21, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Aren't they "curly braces", not "brackets"?

(Or is there some python doc standard here?)

@davepeck davepeck Sep 21, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Update: haha, I checked, and it looks like there's no consistency even in the Python docs.

Here's a google search for "curly braces" in Python docs vs same search for "curly brackets"

Top Google hit for "curly braces" in the docs is inside Format String Syntax

Top Google hit for "curly brackets" in the docs is in the index itself

Happy to go either way here! 🤷🏻‍♂️

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@davepeck I'd use 'curly brackets', it's how we refer to them in the index.

Comment thread Doc/library/string.templatelib.rst Outdated
Comment thread Doc/library/string.templatelib.rst Outdated
Python expression.
For interpolations created from t-string literals, :attr:`!expression`
is the source text found inside the curly braces, including any
whitespace, but excluding the curly braces themselves. For manually

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
whitespace, but excluding the curly braces themselves. For manually
whitespace, but excluding the curly brackets themselves. For manually

Comment thread Doc/library/string.templatelib.rst Outdated
Comment thread Doc/library/string.templatelib.rst Outdated
davepeck and others added 3 commits September 21, 2025 10:21
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@davepeck

davepeck commented Sep 21, 2025

Copy link
Copy Markdown
Contributor Author

Some suggestions -- these will need wrapping though, sorry, I'm on mobile.

Thanks! Applied all of them but waiting for your final input on "curly braces" vs "curly brackets" since the docs seem inconsistent on this.

Comment thread Doc/library/string.templatelib.rst Outdated

@lysnikolaou lysnikolaou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@davepeck

davepeck commented Oct 3, 2025

Copy link
Copy Markdown
Contributor Author

@AA-Turner This is the other one I'm hoping we merge in time for 3.14.0 final -- I've applied all your changes but waiting on your final input on curly braces vs brackets. Thanks! :-)

@AA-Turner

AA-Turner commented Oct 3, 2025

Copy link
Copy Markdown
Member

@davepeck Did you see my earlier comment? I hadn't realiased anything was still waiting on me, sorry.

@davepeck

davepeck commented Oct 4, 2025

Copy link
Copy Markdown
Contributor Author

Did you see my earlier comment?

Oh sheesh, no, somehow I missed it. Sorry about that!

@AA-Turner Just changed all curly braces to curly brackets. Hopefully we're good to merge. Thanks!

@AA-Turner AA-Turner merged commit 880c952 into python:main Oct 4, 2025
27 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Oct 4, 2025
@miss-islington-app

Copy link
Copy Markdown

Thanks @davepeck for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 4, 2025
…ythonGH-139187)

(cherry picked from commit 880c952)

Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@bedevere-app

bedevere-app Bot commented Oct 4, 2025

Copy link
Copy Markdown

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Oct 4, 2025
hugovk pushed a commit that referenced this pull request Oct 5, 2025
…GH-139187) (#139579)

gh-138558: Improve description of ``Interpolation.expression`` (GH-139187)
(cherry picked from commit 880c952)

Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
danigm pushed a commit to openSUSE-Python/cpython that referenced this pull request Oct 7, 2025
…ython#139187)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants