News for hackers. Stuff that matters.
Re:PEP 750 – Template Strings (t-strings) have been accepted by chrome111 on Friday April 11, 2025 @07:44AM (#43652754)
Thanks for this example - it makes it clear it can be a mechanism for something like sqlc/typed sql (my go-to with python too, don't like orms) without a transpilation step or arguably awkward language API wrappers to the SQL. We'll need linters to prevent accidentally using `f` instead of `t` but I guess we needed that already anyways. Great to be able to see the actual cost in the DB without having to actually find the query for something like `typeddb.SelectActiveAccount(I'd)`. Good stuff.
Re:PEP 750 – Template Strings (t-strings) have been accepted by WorldMaker on Friday April 11, 2025 @11:05AM (#43654631)
The PEP says these return a new type `Template`, so you should be able to both type and/or duck type for these specifically and reject non-Template inputs.
Re:PEP 750 – Template Strings (t-strings) have been accepted by paulddraper on Friday April 11, 2025 @12:47PM (#43655870)
It is a different type.

You can verify that either via static typechecking, or at runtime.