@@ -454,7 +454,7 @@ The debug specifier, ``=``, is supported in template strings and behaves similar
454454to how it behaves in f-strings, though due to limitations of the implementation
455455there is a slight difference.
456456
457- In particular, ``t'{expression =}' `` is treated as ``t'expression={expression !r}' ``:
457+ In particular, ``t'{foo =}' `` is treated as ``t'foo={foo !r}' ``:
458458
459459.. code-block :: python
460460
@@ -464,11 +464,11 @@ In particular, ``t'{expression=}'`` is treated as ``t'expression={expression!r}'
464464 assert template.interpolations[0 ].value == " World"
465465 assert template.interpolations[0 ].conversion == " r"
466466
467- If a separate format string is also provided, ``t'{expression =:fmt} `` is treated
468- instead as ``t'expression={expression !s:fmt}' ``.
467+ If a separate format string is also provided, ``t'{foo =:fmt} `` is treated
468+ instead as ``t'foo={foo !s:fmt}' ``.
469469
470- Whitespace is preserved in the debug specifier, so ``t'{expression = }' `` is
471- treated as ``t'expression = {expression !r}' ``.
470+ Whitespace is preserved in the debug specifier, so ``t'{foo = }' `` is
471+ treated as ``t'foo = {foo !r}' ``.
472472
473473
474474Raw Template Strings
@@ -1304,18 +1304,18 @@ First, ``Interpolation.format_spec`` defaults to ``""`` if not provided:
13041304
13051305 Next, the debug specifier, ``= ``, is treated as a special case and is processed
13061306before the AST is created. It is therefore not possible to distinguish
1307- ``t"{expression =}" `` from ``t"expression={expression !r}" ``:
1307+ ``t"{foo =}" `` from ``t"foo={foo !r}" ``:
13081308
13091309.. code-block :: python
13101310
1311- value = 42
1312- template1 = t" {value =}"
1313- template2 = t" value= {value !r }"
1314- assert template1.strings[0 ] == " value ="
1315- assert template1.interpolations[0 ].expression == " value "
1311+ foo = 42
1312+ template1 = t" {foo =}"
1313+ template2 = t" foo= {foo !r }"
1314+ assert template1.strings[0 ] == " foo ="
1315+ assert template1.interpolations[0 ].expression == " foo "
13161316 assert template1.interpolations[0 ].conversion == " r"
1317- assert template2.strings[0 ] == " value ="
1318- assert template2.interpolations[0 ].expression == " value "
1317+ assert template2.strings[0 ] == " foo ="
1318+ assert template2.interpolations[0 ].expression == " foo "
13191319 assert template2.interpolations[0 ].conversion == " r"
13201320
13211321 Finally, format specifiers in f-strings allow arbitrary nesting. In this PEP
0 commit comments