This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients docs@python, eric.smith
Date 2020-06-19.23:53:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The feature of f-strings using '=' for "debugging" formatting is not documented.

>>> foo = 'bar'
>>> f'{foo=}'

I'm not sure where this should fit in to the documentation, but it needs to be in there somewhere.

Basically the documentation needs to say:

1. The entire string from the opening brace { to the start of the expression appears in the output. This allows things like f'{foo = }' to evaluate to "foo = 'bar'" (notice the extra spaces).

2. If no format spec (like :20) is given, repr() is used on the expression. If a format spec is given, then str() is used on the expression. You can use repr() with a format spec by using the !r conversion, like: 

>>> f'{foo=:20}'
'foo=bar                 '

>>> f'{foo=!r:20}'
"foo='bar'               "
Date User Action Args
2020-06-19 23:53:12eric.smithsetrecipients: + eric.smith, docs@python
2020-06-19 23:53:12eric.smithsetmessageid: <>
2020-06-19 23:53:12eric.smithlinkissue41045 messages
2020-06-19 23:53:12eric.smithcreate