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 barry, eric.smith, larry, levkivskyi, serhiy.storchaka
Date 2019-05-07.08:17:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> In you example the format spec is applied to both the value and the literal representation of the expression. Is it an error? I do not think this is an expected behavior.

No, you're misreading it. I admit that my example wasn't great. Try this one:

>>> for n in nums:
...   print(f'*{n=:+<30}*')

> If you want to apply it to both the literal expression and its value you can use the nested f-string: f"*{f'{n=}':30}*".

Correct. There's a similar discussion in issue36774.
Date User Action Args
2019-05-07 08:17:50eric.smithsetrecipients: + eric.smith, barry, larry, serhiy.storchaka, levkivskyi
2019-05-07 08:17:50eric.smithsetmessageid: <>
2019-05-07 08:17:50eric.smithlinkissue36817 messages
2019-05-07 08:17:50eric.smithcreate