On Sat, May 12, 2018 at 9:11 PM, Eric V. Smith <e...@trueblade.com> wrote: > I don't think it matters to its acceptance, but PEP 572 should at least > mention that the := syntax means that you cannot use assignment expressions > in f-strings. > > As I wrote in a python-ideas email, f'{x:=4}' already has a defined meaning > (even if no one is using it).
As with lambda functions, you can't write them the simple way. However, you can parenthesize it, and then it works fine. >>> f"@{(lambda: 42)}@" '@<function <lambda> at 0x7f09e18c4268>@' >>> f"@{(y := 1)}@" '@1@' >>> y 1 ChrisA _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com