Skip to content

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

Draft
wants to merge 31 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5a8dbfa
Initial commit.
davepeck Jun 6, 2025
09a1e9e
Make clear the preceding discussion about t-strings creating an insta…
pauleveritt Jun 8, 2025
ec44c2b
Get the import order sorted.
pauleveritt Jun 8, 2025
d8904b6
Correct the Interpolation() calls.
pauleveritt Jun 8, 2025
550aa6d
Add documentation for Interpolation.
pauleveritt Jun 8, 2025
a20e058
Convert to use Sphinx modifiers for type, returns, and rtype.
pauleveritt Jun 8, 2025
1f30739
Add an entry to the glossary.
pauleveritt Jun 8, 2025
d935dd6
Find any occurrences of f-strings that should also mention t-strings.
pauleveritt Jun 8, 2025
1e47362
Fix doctests for str.templatelib
davepeck Jun 12, 2025
7b660be
Start writing the t-strings part of lexical analysis
davepeck Jun 12, 2025
00a535d
Merge branch 'main' into docs/pep750-first-pass
davepeck Jun 12, 2025
fcd74e6
Fix lint issues
davepeck Jun 17, 2025
a796f5d
Fix further sphinx warnings
davepeck Jun 17, 2025
21d337c
More!
davepeck Jun 17, 2025
d043381
Merge branch 'main' into docs/pep750-first-pass
davepeck Jun 26, 2025
9a0a301
Wrap up lexical analysis updates... I think?
davepeck Jun 26, 2025
f2e5ca4
Document the new AST nodes (TemplateStr and Interpolation)
davepeck Jun 26, 2025
8484b81
First pass at documenting BUILD_TEMPLATE and BUILD_INTERPOLATION
davepeck Jun 26, 2025
56ef703
Merge branch 'main' into docs/pep750-first-pass
davepeck Jun 27, 2025
5a8cf1b
Clarify distinction between string.Template and string.templatelib.Te…
davepeck Jun 27, 2025
127ebc6
Simplify the NOTE
davepeck Jun 27, 2025
73e1222
Okay, I'll stop wordsmithing this for now
davepeck Jun 27, 2025
530cb6d
Fix formatting/parameters for TemplateStr/Interpolation AST nodes
davepeck Jun 27, 2025
eaec534
Further ast/dis documentation cleanup
davepeck Jun 27, 2025
05b5beb
Substantial updates to string.templatelib.rst docs
davepeck Jun 27, 2025
680189a
Clarify BUILD_INTERPOLATION behavior
davepeck Jun 27, 2025
71ddbf4
Write a template string "tutorial" in the "fancy input output formatt…
davepeck Jun 29, 2025
1c0ed70
Fix lint issue in inputoutput.rst
davepeck Jun 30, 2025
ecc86c3
Merge branch 'main' into docs/pep750-first-pass
davepeck Jun 30, 2025
64c6758
Fix further lint issues in inputoutput.rst
davepeck Jun 30, 2025
16a995d
Merge branch 'main' into docs/pep750-first-pass
davepeck Jun 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add an entry to the glossary.
  • Loading branch information
pauleveritt committed Jun 8, 2025
commit 1f30739db47da95e651fa6d901ca58b984ae1cb5
5 changes: 5 additions & 0 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,11 @@ Glossary

See also :term:`borrowed reference`.

t-string
String literals prefixed with ``'t'`` or ``'T'`` are commonly called
"t-strings" which is short for
:ref:`template string literals <t-strings>`. See also :pep:`750`.
Copy link
Member

Choose a reason for hiding this comment

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

The PEP is the original change proposal, and it's expected to go go out of date. It's good to have a link to it in the docs (e.g. a “see also” in the main docs for the feature), so people can read the motivation and get at the discussion links, but if there's any other info in the PEP that's relevant to readers, it should go in the docs.

Suggested change
:ref:`template string literals <t-strings>`. See also :pep:`750`.
:ref:`template string literals <t-strings>`.

(And yes, the current docs aren't too great at this.)


text encoding
A string in Python is a sequence of Unicode code points (in range
``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be
Expand Down