For review: PEP 308 - If-then-else expression
Paul Rubin
http
Mon Feb 10 03:58:33 EST 2003
Erik Max Francis <max at alcyone.com> writes:
> > I'm proposing that the parser should decide when it sees the "if" that
> > it is parsing an if-statement and rule out the possibility that it is
> > parsing an expression that is also a statement.
>
> In other words, writing
>
> if C: x else: y
>
> as a standalone statement (the Corner Case) is illegal.
I don't see why that should be illegal, given that there's no doubt
about what it's supposed to do. I don't think it's that useful to do
it, but why treat it specially or make it illegal? After all, writing
2 + 3
as a standalone statement is perfectly legal.
More information about the Python-list
mailing list