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

holger krekel pyth at devel.trillke.net
Sat Feb 8 21:26:39 EST 2003


James P. Rutledge wrote:
> <Opinion>
> 
> After seeing the mistakes that I and others have made with some of the
> current methods of trying to express a similar behavior to the
> conditional expression, also with the proposed syntax, and further
> considering the arguments made by others my opinion tends to be about
> neutral on the idea of adding conditional expressions.
> 
> As far as the syntax of such a conditional expression if it were to be
> added, however, I strongly agree with those who feel that the least
> error prone syntax should read from left to right starting with the
> condition, then the expression to be used if the condition evaluates to
> True, then the expression to be used if the condition evaluates to
> False.  No matter what separators or keywords are used to identify the
> construct and its parts.

What about

    if <cond>: good_name = <expr1>
    else:      good_name = <expr2>

then?  Dead easy and completly backward compatible :-)

    holger





More information about the Python-list mailing list