For review: PEP 308 - If-then-else expression
Andrew Dalke
adalke at mindspring.com
Mon Feb 10 01:09:43 EST 2003
Andrew Koenig
> holger> Maybe Roman Suzi (IIRC) has found one (short-circuiting)
>
> holger> cond -> (true_expr, false_expr)
>
> holger> which i am currently thinking about.
>
> I'm not thrilled about this example because if you cover up the
> "cond ->" part, you get what looks like a tuple, and tuples don't
> short-circuit.
Still against the idea, but what about
cond -> true_expr else false_expr
? Reads in the right order, the -> can be recognized by the
parser, "else" already exists, and you can figure the context
given any two terms, that is,
cond ->
-> true_expr
true_expr else
else false_expr
are all obviously part of an if/else expression and nothing else.
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list