Skip to content

Conversation

davepeck
Copy link
Contributor

@davepeck davepeck commented Sep 20, 2025

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/

Copy link
Member

@AA-Turner AA-Turner left a comment

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

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

Copy link
Contributor Author

@davepeck davepeck Sep 21, 2025

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?)

Copy link
Contributor Author

@davepeck davepeck Sep 21, 2025

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

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

@davepeck
Copy link
Contributor Author

davepeck commented Sep 21, 2025

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.

Copy link
Member

@lysnikolaou lysnikolaou left a comment

Choose a reason for hiding this comment

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

LGTM!

@davepeck
Copy link
Contributor Author

davepeck commented Oct 3, 2025

@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
Copy link
Member

AA-Turner commented Oct 3, 2025

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

@davepeck
Copy link
Contributor Author

davepeck commented Oct 4, 2025

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

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 <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Oct 4, 2025

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 <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
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