
The current restrictions will also confuse some users (e.g. those used to bash, and IIRC JS, where the rules are similar as what Pablo is proposing). -- --Guido van Rossum (python.org/~guido <http://python.org/~guido>)
WRT the similar syntax in bash (and similar shells), there are two options: "string `code` string" "string $(code) string" The latter, $(), allows fully-featured nesting in the way Pablo is suggesting: "string $(code "string2 $(code2) string2" code) string" The former, using backticks, does not allow nesting directly, but it allows extra backslashes inside the backticks to escape the nested ones, like this: "string `code "string2 \`code2\` string2" code` string" This can be nested infinitely using lots of backslashes. Is this worth considering as another option? It doesn't have the disadvantage of complicating lexing (as much), although nesting with backslashes is quite ugly. IMO nesting things in f-strings would be ugly anyway, so I don't think that would matter too much.