Another conditional expression candidate (PEP 308)

Bob berkey berkey at compuserve.com
Sun Feb 16 20:33:26 EST 2003


Evan wrote:
> Secondly, parse this for me (assuming that those who object to mandatory 
> parentheses win):
> 
> x = if c1: e1 elif c2: if c3: e3 else: e4
> 
I'm a newbie.  That else jumped out at me.  It seems ambiguous.
What does this mean?

x = (if c1: e1 elif c2: (if c3: e3 else: e4))
or
x = (if c1: e1 elif c2: (if c3: e3) else: e4)

Elsewhere in the thread you implied the latter.  I just wanted
to reinforce your point, and say this complex enough without having
to decipher which if/elif does that else belong to.

my 2cents
Bob





More information about the Python-list mailing list