Skip to content

Commit 9c88178

Browse files
author
BNAndras
committed
Add t-strings link
1 parent 795b46f commit 9c88178

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

concepts/string-formatting/about.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ If you want to add multiple variables to a string, you need to supply a [tuple][
178178

179179
## Template Strings
180180

181-
[`string.Template()`][string.Template()] is a class from the `string` module (_as opposed to the built-in `str` type_), which is part of the Python standard library, but has to be imported for use.
181+
[`string.Template()`][string.Template()] (_not to be confused with Python 3.14 [t-strings]_) is a class from the `string` module (_as opposed to the built-in `str` type_), which is part of the Python standard library, but has to be imported for use.
182182
Template strings support `$`-based substitution and are much simpler and less capable than the other options mentioned here.
183183
However, they can be very useful for when complicated internationalization is needed, or outside inputs need to be sanitized.
184184
`string.Template` is considered safer for untrusted user input because it prevents evaluating arbitrary expressions or accessing object attributes, which mitigates format-string injection attacks.
@@ -228,5 +228,6 @@ If you want to go further: [all about formatting][all-about-formatting] and [Pyt
228228
[string.Template()]: https://docs.python.org/3/library/string.html#template-strings
229229
[summary-string-format]: https://www.w3schools.com/python/ref_string_format.asp
230230
[template-string]: https://docs.python.org/3/library/string.html#template-strings
231+
[t-strings]: https://realpython.com/python-t-strings/
231232
[tuples]: https://www.w3schools.com/python/python_tuples.asp
232233
[zen-of-python]: https://www.python.org/dev/peps/pep-0020/

0 commit comments

Comments
 (0)