Skip to content

Commit ae2c32f

Browse files
loganasherjonesgvanrossum
authored andcommitted
bpo-36798: Updating f-string docs for := use case (GH-13107)
1 parent f7b494c commit ae2c32f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Doc/reference/lexical_analysis.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -680,11 +680,12 @@ with a closing curly bracket ``'}'``.
680680

681681
Expressions in formatted string literals are treated like regular
682682
Python expressions surrounded by parentheses, with a few exceptions.
683-
An empty expression is not allowed, and a :keyword:`lambda` expression
684-
must be surrounded by explicit parentheses. Replacement expressions
685-
can contain line breaks (e.g. in triple-quoted strings), but they
686-
cannot contain comments. Each expression is evaluated in the context
687-
where the formatted string literal appears, in order from left to right.
683+
An empty expression is not allowed, and both :keyword:`lambda` and
684+
assignment expressions ``:=`` must be surrounded by explicit parentheses.
685+
Replacement expressions can contain line breaks (e.g. in triple-quoted
686+
strings), but they cannot contain comments. Each expression is evaluated
687+
in the context where the formatted string literal appears, in order from
688+
left to right.
688689

689690
If a conversion is specified, the result of evaluating the expression
690691
is converted before formatting. Conversion ``'!s'`` calls :func:`str` on

0 commit comments

Comments
 (0)