For review: PEP 308 - If-then-else expression

Evan evan at 4-am.com
Sat Feb 8 20:28:09 EST 2003


Roy Smith wrote:
> I'm not sure I like the idea, but assuming I did, I think it would be 
> better to have an explicit else: instead of the bare dangling default 
> clause.

Erik Max Francis wrote:
 > Both the use of curly braces and commas seem terribly inappropriate
 > here.  When this is "corrected," you end up with

I'm hardly wedded to syntactical details at this point.  I just want to 
get people thinking beyond variants of "FOO cond BAR expr BAZ expr".

I'd be happy with (almost) any of:

{if cond1: expr1, cond2: expr2, default}
{if cond1: expr1, cond2: expr2, else: default}
(if cond1: expr1, cond2: expr2, else: default)
[if cond1: expr1 elif cond2: expr2 else: default]
if:(cond, expr1, expr2)

Cheers,

Evan @ 4-am





More information about the Python-list mailing list