The fact that adding := support could break existing working code does give me pause to make any change here, and does suggest that a deprecation period would be needed in order to modify the f-string expression scanning behavior.
One concern I have is that if something akin to PEP 536 is used to implement f-strings, then it would require some work (but not be impossible) to avoid allowing :=.
In 3.8, := is prohibited in "expression as a statement" mode, but that's not the mode that f-strings expressions operate in: they're just normal expressions, and I would normally just expect := to work. But the backward compatibility break here is the reason to possibly disallow supporting :=, not that := should just never work in f-strings without parens. |