-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
gh-132661: Document t-strings and templatelib
#135229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…nce of `templatelib.Template`.
@hugovk Thank you for the review and the helpful early feedback! Useful to know about linking. (FWIW this is very early stage still, so I expect plenty more linting and other issues that we'll eventually resolve.) |
Co-authored-by: Petr Viktorin <encukou@gmail.com>
@davepeck The below thoughts are largely things that could be improved after this pull request is merged, if they are improved at all. The documentation currently in this pull request is well-worth merging in my opinion. I am looking forward to seeing this feature officially documented soon! The standard library pageI noticed that Feedback on the
|
... in heaven, everyone reviews code like @treyhunner |
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.
Thank you for this, it's looking good!
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.
This looks great, thank you! I do have a bunch of nitpicks:
Doc/tutorial/inputoutput.rst
Outdated
.. _tut-t-strings: | ||
|
||
Template String Literals | ||
------------------------- |
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.
Could you please leave the tutorial to a separate PR (and replace tut-t-strings
links with t-strings
for now)?
This is a Diátaxis-style tutorial; IMO it would work better as an explanation and/or how-to guide.
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.
My instinct (and my read of review feedback so far) is that it feels like it fits well and follows nicely after the f-string section of the same doc (tutorial/inputoutput.rst
).
Leaving this open while we consider our options here.
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.
I'll happily approve the rest of this PR.
For the tutorial I have more suggestions, so I'm asking to consider the options in a separate PR, to not block this one.
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.
Will do!
@treyhunner Thank you for the amazing review!
Fixed now!
Fixed; thanks.
Agreed. I took another pass at the wording here. I still don't really love it; how does it work for you now?
It's in there but, yeah, it's scattered across description of The key property (which is included in the docs) is that there is always one more element in Related doc content:
I hope this is okay? Earlier versions of the PEP explicitly mentioned alternation and made guarantees about it; the final form of the PEP mostly tries to avoid talking about it. If there's a way we can make these properties clearer sooner in the cpython docs, I'd love to find it — suggestions most welcome.
Hah! I've been going back and forth between "parts" and "items". You're absolutely right, we should settle on something here. I looked over the PEP, docs, and even some older discussions and "parts of a
Thank you, this is useful feedback. I agree we should have something "complete" here. Will consider your cool |
BTW, there's no need to update the PR if it's out of date with the main branch. GitHub just made the button for that too prominent. |
Hah, sorry; I know. It's sorta become a personal bad habit on PRs against active repos. I will refrain! 😅 |
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
… into docs/pep750-first-pass
Co-authored-by: Petr Viktorin <encukou@gmail.com>
@treyhunner I just applied a suggestion from @encukou that I think nicely clarifies the alternation. Let us know what you think. (And: thanks @encukou !) |
@encukou I removed the t-string tutorial for now. When I get a chance next week, I'll pop up a separate PR so we can wrangle it into shape. Onward! :-) |
This PR adds documentation for t-strings, including:
string.templatelib
in the Library reference sectionlexical-analysis.rst
ast
docsBUILD_INTERPOLATION
andBUILD_TEMPLATE
to thedis
docsTemplate strings
section ofDoc/library/string.rst
to clarify that this is unrelated to t-stringsWe also have an issue tracking our original list of PEP 750 documentation tasks.
📚 Documentation preview 📚: https://cpython-previews--135229.org.readthedocs.build/