Perhaps using a parenthesized assignment expression with the walrus operator would be unambiguous:
(spam := eggs) if bar
I think that seems reasonable? It would act just the same as it already does with an explicit `else None`, if I'm not mistaken. I don't find it beautiful though.
Comments
Perhaps using a parenthesized assignment expression with the walrus operator would be unambiguous:
(spam := eggs) if bar
I think that seems reasonable? It would act just the same as it already does with an explicit `else None`, if I'm not mistaken. I don't find it beautiful though.