diff options
author | Eric V. Smith <ericvsmith@users.noreply.github.com> | 2019-05-08 20:28:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-08 20:28:48 (GMT) |
commit | 9a4135e939bc223f592045a38e0f927ba170da32 (patch) | |
tree | de347c6f2df801dc98b36ab5084dada335741517 /Misc/NEWS.d | |
parent | 65d98d0f53f558d7c799098da0abf376068c15fd (diff) | |
download | cpython-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 'Misc/NEWS.d')
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2019-05-02-11-48-08.bpo-36774.ZqbJ1J.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-05-02-11-48-08.bpo-36774.ZqbJ1J.rst b/Misc/NEWS.d/next/Core and Builtins/2019-05-02-11-48-08.bpo-36774.ZqbJ1J.rst new file mode 100644 index 0000000..b73547c --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-05-02-11-48-08.bpo-36774.ZqbJ1J.rst @@ -0,0 +1,7 @@ +Add a ``=`` feature f-strings for debugging. This can precede ``!s``, +``!r``, or ``!a``. It produces the text of the expression, followed by +an equal sign, followed by the repr of the value of the expression. So +``f'{3*9+15=}'`` would be equal to the string ``'3*9+15=42'``. If +``=`` is specified, the default conversion is set to ``!r``, unless a +format spec is given, in which case the formatting behavior is +unchanged, and __format__ will be used. |