Proposed PEP for a Conditional Expression

Terry Reedy tjreedy at
Wed Sep 12 19:12:06 CEST 2001

"Joshua Marshall" <jmarshal at> wrote in message
news:9nnsa3$bjl$1 at
> thp at wrote:
> > Bernhard Herzog <bh at> wrote:
> > [...]
> > : Another way that come to mind:
> > :         <expr> if <cond> else <expr>
> One thing I don't like about this suggestion is that <cond> is
> evaluated before the first <expr> is [potentially] evaluated, even
> though <expr> syntactically precedes <cond>.

I agree that the above is backwards.
<cond> if <expr> else <expr>
would remove that objection and make the syntax parallel to
<cond> ? <expr> : <expr>

Terry J. Reedy

More information about the Python-list mailing list