[New-bugs-announce] [issue36798] := breaks f-strings

Eric V. Smith report at bugs.python.org
Sat May 4 21:23:34 EDT 2019


New submission from Eric V. Smith <eric at trueblade.com>:

The walrus operator breaks f-strings, because the f-string scanner sees the colon as the end of the expression.

>>> x = '10'
>>> f'{x:=10}'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: '=' alignment not allowed in string format specifier

This becomes: format(x, '=10'), which is an error if x is a string.

----------
assignee: eric.smith
components: Interpreter Core
messages: 341413
nosy: eric.smith, larry, lukasz.langa
priority: release blocker
severity: normal
status: open
title: := breaks f-strings
versions: Python 3.8

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


More information about the New-bugs-announce mailing list