Hacker News new | ask | show | jobs
by nine_k 430 days ago
I understand your concern, and I think the PEP addresses it. Quite bluntly, t"foo" is not a string, while f"foo" is. You'll get a typecheck error if you run a typechecker like any reasonable developer, and will get a runtime error if you ignore the type mismatch, because t"foo" even lacks a __str__() method.

One statement the PEP could put front and center in the abstract could be "t-strings are not strings".

2 comments

> "t-strings are not strings"

t-string is an unfortunate name for something that is not a string.

I wish it were called "string templates" instead, with t"whatever" form being called a "template literal".
Simpson's Individual Stringettes!

https://www.youtube.com/watch?v=7qNj-QFZbew

Away with floods! Away with workaday tidal waves!