> 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.

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/R5NNGXYOU74VEXCBF7API7EFRGLN7MWJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to