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

Sean Ross sross at
Sat Feb 8 18:14:24 CET 2003

> ... I would be willing to abstain from (or possibly even vote for) a
> proposal that reads left-to-right *and* doesn't muck with the if
> statement.  So far, the only proposals that work on those grounds are
>     <cond> ? <exp1> : <exp2>
> and
>     when <cond> then <exp1> else <exp2>
> --
> Aahz (aahz at           <*>
> Register for PyCon now!

I like the latter best, but then, of course, this introduces _two_ new
keywords.(which doesn't bother me, but it'll bother others).

    <exp1> when <cond> else <exp2>,

may not read strictly left to right(although, to me, it does), but it only
introduces one new keyword(which may prove less anathemic)
Either 'when' version would be fine by me. <cond>?<exp1>:<exp2>, for purely
aesthethic reasons, I don't care for as much, but it is familiar.

More information about the Python-list mailing list