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

David Eppstein eppstein at ics.uci.edu
Sat Feb 8 02:57:16 CET 2003


In article <ad052e5c.0302071620.4816439a at posting.google.com>,
 danb_83 at yahoo.com (Dan Bishop) wrote:

> I like the idea but hate the (imho) convoluted order of the condition
> and expressions.

I on the other hand think the order is one of the better parts of the 
proposal.  Just because it's not the same as C, doesn't make it bad...
Try thinking about it, playing with it, before reacting so quickly.

> > Alternatives
> [snip]
> >     If we could live with adding a new keyword, we could use:
> > 
> >         if <condition> then <expression1> else <expression2>
> >
> >     Apart from the problem of introducing a new keyword for a minor
> >     feature, this also suffers from ambiguity at the start of a
> >     statement; for example:
> 
> In the other thread, I suggested the syntax
> 
> (if condition: expression1 else expression2)  # parentheses are
> required

-1 on this (and on most of the alternatives other people have proposed 
in this thread).  In this case, my reason is that the required parens 
make it too easy to confuse with tuples.

-- 
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/




More information about the Python-list mailing list