That doesn't automatically mean it's a good idea in C++, knowing C++ there are gonna be a whole lot of gotchas which aren't in Python, but it means that, at least in my opinion, how F-strings worked in Python is an argument in favor of them rather than against them.
Swift strings have ONE string. Just a single clean design that does all of that. With a simple set of rules.
You might be on your own here.
To quote myself:
Yea, f-strings are nice. But f-strings, r-strings, \ escaping, {{ escaping, ''' strings? Horrible.
Swift strings have ONE string. Just a single clean design that does all of that. With a simple set of rules.
Swift has just 1 string.
Look up Swift strings. Python has 4 types of string literals. Swift has 1. And they are BETTER and more powerful. Cleaner.
So compared to Python, string interpolation is always "on" and doesn't need an f-prefix. Because it uses the string escaping syntax, it doesn't have to take over a regular character like {, which requires {{ escaping.
There are two errors you could make in Python. Accidentally using {} in a normal string where you wanted interpolation, and accidentally using {} in an f-string where you wanted literal {}. I definitely do the former a lot.
And you can do this:
####"foo ###\(this is not interpolation) ####\(but this is) bar"####
In Pythons f-strings you can't ever write the literal `{foo}` in a string for documentation for example. It's a mess.
Swift doesn't have raw strings and normal strings. Swift has ONE syntax:
{#n}"string {#n}\(interpolation)"{#*n}
Where n can be zero or more. So let's recap:
1. ONE rule for start/end/escape prefix: A number of # that has to match. 2. ONE rule for escape: \.
I do Python full time and I wouldn't consider switching to Swift, but the string situation is horrible compared to Swift.
There is always a clean escape where you can write the literal that you want to write. Unlike in Python where there is no escape (amusingly).
I tried to warn the D guys not to make this exact mistake, but they didn't listen :/