summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/tutorial/inputoutput.rst12
-rw-r--r--Doc/whatsnew/3.8.rst1
2 files changed, 12 insertions, 1 deletions
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index d341400..de84ab7 100644
--- a/Doc/tutorial/inputoutput.rst
+++ b/Doc/tutorial/inputoutput.rst
@@ -133,7 +133,17 @@ applies :func:`repr`::
>>> print(f'My hovercraft is full of {animals!r}.')
My hovercraft is full of 'eels'.
-For a reference on these format specifications, see
+The ``=`` specifier can be used to expand an expression to the text of the
+expression, an equal sign, then the representation of the evaluated expression:
+
+ >>> bugs = 'roaches'
+ >>> count = 13
+ >>> area = 'living room'
+ >>> print(f'Debugging {bugs=} {count=} {area=}')
+ Debugging bugs='roaches' count=13 area='living room'
+
+See :ref:`self-documenting expressions <bpo-36817-whatsnew>` for more information
+on the ``=`` specifier. For a reference on these format specifications, see
the reference guide for the :ref:`formatspec`.
.. _tut-string-format:
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 51e1f9a..6138576 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -250,6 +250,7 @@ Android and Cygwin, whose cases are handled by the script);
this change is backward incompatible on purpose.
(Contributed by Victor Stinner in :issue:`36721`.)
+.. _bpo-36817-whatsnew:
f-strings support ``=`` for self-documenting expressions and debugging
----------------------------------------------------------------------