For review: PEP 308 - If-then-else expression
Michele Simionato
mis6 at pitt.edu
Sat Feb 8 08:16:24 EST 2003
"Sean Ross" <frobozz_electric at hotmail.com> wrote in message news:<5DV0a.34649$CF1.1127662 at news20.bellglobal.com>...
> >
> > The proposed syntax is as follows:
> >
> > <expression1> if <condition> else <expression2>
> >
>
> While I do not think this is necessary, I would like to offer an alternative
> syntax:
>
> <expression1> when <condition> else <expression2>
>
+1 to "when". To me "if" is associated to the conditional statement, a
conditional expression is a conceptually different thing and needs a
different expression. Readability is worth adding a new keyword.
P.S. I don't like your other proposal with the comma, my mind parses
when C,x as the tuple when (C,x).
More information about the Python-list
mailing list