[Python-ideas] PEP 572: Assignment Expressions (post #4)
Paul Moore
p.f.moore at gmail.com
Wed Apr 11 10:11:02 EDT 2018
On 11 April 2018 at 14:54, Chris Angelico <rosuav at gmail.com> wrote:
> Sure, if you're just assigning zero to everything. But you could do
> that with a statement. What about this:
>
> q = {
> lambda: x := lambda y: z := a := 0,
> }
>
> Yes, it's an extreme example, but look at all those colons and tell me
> if you can figure out what each one is doing.
lambda: x := (lambda y: (z := (a := 0)))
As I say, it's the only *possible* parsing. It's ugly, and it
absolutely should be parenthesised, but there's no need to make the
parentheses mandatory. (And actually, it didn't take me long to add
those parentheses, it's not *hard* to parse correctly - for a human).
Paul
More information about the Python-ideas
mailing list