~/talk

Introducing t-strings: f-strings with superpowers

Talkat PyCascades 2026 · 2026-03-21..03-22· [python, security]
name:Dave Peck
links:none on file
slides:none on file

Python 3.14 adds t-strings that use f-string syntax but evaluate to a Template instance (string.template) so code can inspect static vs interpolated parts instead of getting a str; that lets libraries escape untrusted SQL/HTML (prevents Bobby Tables style injection), implement grammar-aware rendering (attribute spreading and component calls), and treat format specs/conversions themselves (no TypeError when dunder format rejects a spec). Examples: tdom (pre‑alpha, faster than Django templates but behind Jinja2) and t-sql plus a VS Code tooling demo.

AI-written summary · about

  1. 0:00t-strings in Python 3.14
  2. 2:01What are t-strings
  3. 3:36t-strings vs f-strings
  4. 5:54Processing templates
  5. 7:01Why t-strings needed
  6. 8:39SQL injection prevention
  7. 9:50Safe HTML rendering
  8. 11:27f-strings vs t-strings
  9. 12:28fstrings.wtf and format specs
  10. 15:58Custom format specs
  11. 16:21Chess notation with t-strings
  12. 18:13Music notation with t-strings
  13. 20:33TDOM and t-string libraries
  14. 21:17Girl Scout cookies
  15. 22:48Building CookieTrails
  16. 24:29TDOM vs Django templates
  17. 25:46TDOM performance
  18. 26:55Reflecting on t-strings
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.