[New-bugs-announce] [issue43695] Improve `=` in f-strings

wyz23x2 report at bugs.python.org
Thu Apr 1 08:25:56 EDT 2021


New submission from wyz23x2 <wyz23x2 at 163.com>:

In Python 3.8, `=` was added into f-strings:
>>> a, b, c = 20, 40, 10
>>> f'{a+b-c=}'
a+b-c=50
But if `20+40-10` is wanted, this needs to be written:
>>> f'{a}+{b}-{c}={a+b-c}'
20+40-10=50
So something could be added. For example, `?` (this doesn't mean I recommend the question mark):
>>> f'{a?+b?-c?=}'
20+40-10=50
>>> f'{a+b?-c=}'
a+40-c=50
>>> f'{a+b-c=?}'  # Suffix `=` to apply to all?
20+40-10

Suggestions?

----------
components: Interpreter Core
messages: 389979
nosy: wyz23x2
priority: normal
severity: normal
status: open
title: Improve `=` in f-strings
type: enhancement
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43695>
_______________________________________


More information about the New-bugs-announce mailing list