It's actually one of the most powerful enhancements one can make to a programming language
It's actually one of the most powerful enhancements one can make to a programming language
Posted Jan 26, 2025 23:59 UTC (Sun) by marcH (subscriber, #57642)In reply to: It's actually one of the most powerful enhancements one can make to a programming language by rrolls
Parent article: A revamped Python string-formatting proposal
In these situations there is really only one way: finding good _demoes_ as you just did above. They have to be short and simple enough to be in reach of "casual" readers with limited time, while being complex enough to demonstrate real value. It can be pretty hard and also very dependent on the new feature itself.
From https://lwn.net/Articles/1005903/ above
> There is a wealth of experience now on SQL injections, JS injections, and the like, ...
> But with a t-string, LibFoo knows exactly which parts were written by Alice and intended to be treated as syntax, and which parts were passed in via substitutions.
This looks pretty much like SQL's "PreparedStatements" which is the (universal?) cure for SQL injections. Are these new templates following the same logic? That is: _not_ "serializing"/flattening but preserving structure? In a more generic way and in a more generic language.
So, maybe rewriting this with t-strings would make a good demo?
https://en.wikipedia.org/wiki/Prepared_statement#Python_D...
Not because it would show anything significantly new, but because it would show how more generic t-strings are?
