[Python-ideas] PEP 572: about the operator precedence of :=

Chris Angelico rosuav at gmail.com
Thu May 10 05:08:59 EDT 2018


On Thu, May 10, 2018 at 7:04 PM, M.-A. Lemburg <mal at egenix.com> wrote:
> Not sure whether this was discussed before (I'm not really
> following the discussion), but what happens if you write:
>
> check = 0 and (a := 1)
>
> ? Will "a" get assigned or not ?

No, it won't. It's the same as any other side effects after an 'and' -
that expression is completely not evaluated.

ChrisA


More information about the Python-ideas mailing list