PEP 750 - T-strings: safer and smarter string processing
summary
PEP 750 ships t‑strings in Python 3.14 as a template object type that yields an intermediate object not a plain str, exposing .strings, .interpolation and .values so code can run lazy interpolation, sanitise inputs (XSS, SQL injection), transform and compose templates before rendering. The implementation is in the string package and libraries already backport sanitizer helpers (html, tsql). Demos show a processing method that concatenates and escapes correctly; tradeoffs are extra boilerplate, some runtime cost and partial standardisation.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 2:53Motivations behind T-strings
- 4:58Limitations of string methods
- 8:29What are T-strings
- 11:44Processing T-strings
- 13:29T-strings vs other methods
- 14:56Security use cases
- 16:42DSL and template breakdown
- 17:23T-strings for logging
- 18:27Drawbacks and performance
- 20:54Standardization challenges
- 21:36Final thoughts
- 23:25Q&A
related talks
29mUncovering the magic of implementing a new Python syntax feature
27m"Disentangling formatted strings with T-strings"
28mIntroducing t-strings: f-strings with superpowers
20mPEP 498: The Monologue
17mHow Python Evolves: The Role of Python Enhancement Proposals (PEPs)
28mSecuring Code with the Python Type System
24mF Strings!
25mDecoding the Frustrations and Vulnerabilities of Modern Text Processing
