[docs] [issue28590] fstring's '{' from escape sequences does not start an expression
Jason R. Coombs
report at bugs.python.org
Sun Nov 6 11:10:37 EST 2016
Jason R. Coombs added the comment:
The reason that those test_no_escapes_for_braces assertions pass is because they're only dealing with opening curly braces and in an f-string, they're treated as literal opening braces.
In the example you've given, the error occurs when the f-string handler encounters the closing curly brace without an opening one. It's the same as if you had written:
>>> f'{{4*10}'
SyntaxError: f-string: single '}' is not allowed
I will add a test to capture this specific case (backslash-escaped unicode opening bracken).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28590>
_______________________________________
More information about the docs
mailing list