Proposed PEP for a Conditional Expression

Markus Schaber markus at schabi.de
Fri Sep 14 05:34:53 EDT 2001


Hi,

Gareth McCaughan <Gareth.McCaughan at pobox.com> schrub:

> It isn't exactly like C, because the C syntax doesn't
> abuse the word "if". If you use words from a natural
> language, it is best to use them in a way reasonably
> compatible with that language. "<condition> if <expression> ..."
> completely fails this test, and I too think it could only
> appeal to someone who'd got used to it by programming in
> Forth.

What about "(<cond>: return <expr> [else return <expr])" - yes, I want 
to make the else optional (returning None otherwise). But the () around 
it have to be there.

May be even "(<cond>: <expr> [else <expr>])" would be usable.

In my thinking of natural and mathematical language, the : is a way of 
indicating that the condition proposes the expression.
 
markus
-- 
"The strength of the Constitution lies entirely in the determination of 
each citizen to defend it. Only if every single citizen feels duty 
bound to do his share in this defense are the constitutional rights 
secure." -- Albert Einstein



More information about the Python-list mailing list