Issue 28597: f-string behavior is conflicting with its documentation (original) (raw)

The file:

/Doc/reference/lexical_analysis.rst says that things as:

f"abc {a["x"]} def" # workaround: escape the inner quotes f"newline: {ord('\n')}" # workaround: double escaping fr"newline: {ord('\n')}" # workaround: raw outer string

are accepted in f-strings, yet, all those examples raise a:

SyntaxError: f-string expression part cannot include a backslash

The current Python version where this was tested is: 3.6.0b4

So, either those cases should be supported or lexical_analysis.rst should be updated to say that '' is not valid in the expression part of f-strings.