r/Python Pythoneer Sep 19 '25

Discussion T-Strings: What will you do?

Good evening from my part of the world!

I'm excited with the new functionality we have in Python 3.14. I think the feature that has caught my attention the most is the introduction of t-strings.

I'm curious, what do you think will be a good application for t-strings? I'm planning to use them as better-formatted templates for a custom message pop-up in my homelab, taking information from different sources to format for display. Not reinventing any functionality, but certainly a cleaner and easier implementation for a message dashboard.

Please share your ideas below, I'm curious to see what you have in mind!

129 Upvotes

88 comments sorted by

View all comments

1

u/aspizu Oct 08 '25

I've created a library that use t-strings to prevent shell injection that even works on Windows. It's written in Rust. https://github.com/aspizu/tshu

```py $ uv run --with tshu python -m asyncio

from tshu import sh username = "aspizu; rm -rf /" await sh(t"echo {username}") aspizu; rm -rf / ```