summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorEric V. Smith <ericvsmith@users.noreply.github.com>2019-05-08 20:28:48 (GMT)
committerGitHub <noreply@github.com>2019-05-08 20:28:48 (GMT)
commit9a4135e939bc223f592045a38e0f927ba170da32 (patch)
treede347c6f2df801dc98b36ab5084dada335741517 /Doc/whatsnew
parent65d98d0f53f558d7c799098da0abf376068c15fd (diff)
downloadcpython-9a4135e939bc223f592045a38e0f927ba170da32.zip
cpython-9a4135e939bc223f592045a38e0f927ba170da32.tar.gz
cpython-9a4135e939bc223f592045a38e0f927ba170da32.tar.bz2
bpo-36817: Add f-string debugging using '='. (GH-13123)
If a "=" is specified a the end of an f-string expression, the f-string will evaluate to the text of the expression, followed by '=', followed by the repr of the value of the expression.
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/3.8.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index d6388f8..874b9b1 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -148,6 +148,20 @@ extensions compiled in release mode and for C extensions compiled with the
stable ABI.
(Contributed by Victor Stinner in :issue:`36722`.)
+f-strings now support = for quick and easy debugging
+-----------------------------------------------------
+
+Add ``=`` specifier to f-strings. ``f'{expr=}'`` expands
+to the text of the expression, an equal sign, then the repr of the
+evaluated expression. So::
+
+ x = 3
+ print(f'{x*9 + 15=}')
+
+Would print ``x*9 + 15=42``.
+
+(Contributed by Eric V. Smith and Larry Hastings in :issue:`36817`.)
+
Other Language Changes
======================