PEP 308: Precendence of "a then b else c"

John Roth johnroth at
Thu Feb 13 14:27:49 CET 2003

My newsreader seems to have quit putting >s in the margins. Sigh.

"Harvey Thomas" <hst at> wrote in message
news:mailman.1045137465.10272.python-list at

With some proposals put forward there is possibility for confusion if
colons, particularly as in else: are used as I can imagine it's not
always going to be clear whether a code fragment is part of an
if/elif/else statement construct or a conditional expression.

The proposal on the table requires parenthesis around the entire figure:

(if <condition>: <expression> else: <expression)

There is no ambiguity.

John Roth

More information about the Python-list mailing list