PEP 308: Precedence of "a then b else c"

Anders J. Munch andersjm at dancontrol.dk
Thu Feb 13 13:20:29 EST 2003


I wrote:
>> What's the precedence of this thing?
"Chermside, Michael" <mchermside at ingdirect.com> wrote:
>Based on discussion on python-dev, I believe the intent is to
>have a precedence just below that of lambda. 

That makes sense.

>Thus, your examples above would be equivalent to the following:
>
>    (a + b) then c else d
>    a then b else (c + d)
>    (a and b) then c else d
>    a then b else (c and d)
>    (a, b) then c else d
>    a then b else (c, d)
>    lambda: (a then b else c)

Forgot an important case, function calls:
     f(a,b then c else d,e)

I gather that would be equivalent to
     f(a, (b then c else d), e)

- Anders






More information about the Python-list mailing list