File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,17 @@ applies :func:`repr`::
133133 >>> print(f'My hovercraft is full of {animals!r}.')
134134 My hovercraft is full of 'eels'.
135135
136- For a reference on these format specifications, see
136+ The ``= `` specifier can be used to expand an expression to the text of the
137+ expression, an equal sign, then the representation of the evaluated expression:
138+
139+ >>> bugs = ' roaches'
140+ >>> count = 13
141+ >>> area = ' living room'
142+ >>> print (f ' Debugging { bugs= } { count= } { area= } ' )
143+ Debugging bugs='roaches' count=13 area='living room'
144+
145+ See :ref: `self-documenting expressions <bpo-36817-whatsnew >` for more information
146+ on the ``= `` specifier. For a reference on these format specifications, see
137147the reference guide for the :ref: `formatspec `.
138148
139149.. _tut-string-format :
Original file line number Diff line number Diff line change @@ -250,6 +250,7 @@ Android and Cygwin, whose cases are handled by the script);
250250this change is backward incompatible on purpose.
251251(Contributed by Victor Stinner in :issue: `36721 `.)
252252
253+ .. _bpo-36817-whatsnew :
253254
254255f-strings support ``= `` for self-documenting expressions and debugging
255256----------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments