"Disentangling formatted strings with T-strings"
summary
Python 3.14 adds t-strings that evaluate to a Template type not a plain string, exposing an interpolation object (value, expression, conversion, format spec) so library code can sanitize or transform parts before final rendering. Intended audience is template-processing and framework authors, not casual app writers; functions can type-check for Template vs f-string and reject unsafe inputs. The claim is that separating template and data prevents injection classes like SQLi and XSS, but safety depends on libraries adopting and implementing the sanitizers.
AI-written summary · about
chapters (8)
- 0:00T-strings intro
- 2:03Python string formatting evolution
- 4:33String interpolation risks
- 7:02T-strings purpose
- 10:56Guardrails in Python/T-strings
- 13:25Pattern matching T-strings
- 16:59T-strings key takeaways
- 18:44Q&A
related talks
28mIntroducing t-strings: f-strings with superpowers
31mPEP 750 - T-strings: safer and smarter string processing
29mUncovering the magic of implementing a new Python syntax feature
24mF Strings!
35mText Is Not Text: The History of Strings in Python
28mSecuring Code with the Python Type System
12mType Annotations in Python: Terribly Intimidating or Tremendously Informative?
25mDecoding the Frustrations and Vulnerabilities of Modern Text Processing
