←back to thread

620 points tambourine_man | 1 comments | | HN request time: 0.207s | source
Show context
sashank_1509 ◴[] No.43749826[source]
Why does this need to be a language feature. This could just be a separate library, we could use brackets instead of a letter before a string. I fear, Python is going down the path of C++
replies(7): >>43749868 #>>43749921 #>>43749980 #>>43750107 #>>43750832 #>>43751165 #>>43751480 #
1. Mawr ◴[] No.43750832[source]
It's not as simple as "more features" == "closer to C++". Features are not equal to each other in terms of impact on language complexity.

t-strings don't interact with anything else in the language; they, as you yourself pointed out, could almost be an isolated library. That makes them low impact.

This is also true syntactically; they're just another type of string, denoted by "t" instead of "f". That's easy to fit into one's existing model of the language.

Moreover, even semantically, from the point of view of most language users, they are equivalent to f-strings in every way, so there's nothing to learn, really. It's only the library writers who need to learn about them.

Then we have to consider the upsides - the potential to eliminate SQL and HTML injection attacks. The value/cost is so high the feature a no-brainer.