PEP 308: Alternative conditional operator forms
Dave Brueck
dave at pythonapocrypha.com
Tue Feb 11 11:45:40 EST 2003
On Tue, 11 Feb 2003, Michele Simionato wrote:
> > What I'd really like is to have the conditional come first, and avoid
> > overloading the 'if' keyword. Obviously else is already overloaded,
> > and fits nicely in context.
> >
> > Nick
>
> I was thinking to this possibility (without the colons).
> Notice that "then" could be a pseudo-keyword analogous to "as". I
> would support this more than
>
> (if C: x else: y)
>
> that I dislike since
>
> 1) overload "if"
Out of curiosity, in what way is "if" overloaded? The reason I like 'if'
in this context is because it means the _exact_ same thing it does in an
if-statement: a condition is about to be checked in order to make a binary
desicion. Because it means the same thing as it does in an if-statement,
it's so much easier to guess the meaning if you're not familiar with it.
The colon and (usually) indentation is what marks the beginning of a block
of code under an 'if', not the 'if' itself.
-Dave
More information about the Python-list
mailing list