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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting merge 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.

3 participants