]> granicus.if.org Git - python/commitdiff
bpo-36798: Updating f-string docs for := use case (GH-13107)
authorLogan Jones <loganasherjones@gmail.com>
Mon, 6 May 2019 16:32:44 +0000 (12:32 -0400)
committerGuido van Rossum <guido@python.org>
Mon, 6 May 2019 16:32:44 +0000 (11:32 -0500)
Doc/reference/lexical_analysis.rst

index fb04ccc839aaa31bab58d71d3f199fef116515d4..13adc1a2e433fc6cea90cbe7721572b274c33bba 100644 (file)
@@ -680,11 +680,12 @@ with a closing curly bracket ``'}'``.
 
 Expressions in formatted string literals are treated like regular
 Python expressions surrounded by parentheses, with a few exceptions.
-An empty expression is not allowed, and a :keyword:`lambda` expression
-must be surrounded by explicit parentheses.  Replacement expressions
-can contain line breaks (e.g. in triple-quoted strings), but they
-cannot contain comments.  Each expression is evaluated in the context
-where the formatted string literal appears, in order from left to right.
+An empty expression is not allowed, and both :keyword:`lambda`  and
+assignment expressions ``:=`` must be surrounded by explicit parentheses.
+Replacement expressions can contain line breaks (e.g. in triple-quoted
+strings), but they cannot contain comments.  Each expression is evaluated
+in the context where the formatted string literal appears, in order from
+left to right.
 
 If a conversion is specified, the result of evaluating the expression
 is converted before formatting.  Conversion ``'!s'`` calls :func:`str` on