PEP-308 a "simplicity-first" alternative
Tim Peters
tim.one at comcast.net
Tue Feb 11 16:33:38 EST 2003
[Raymond Hettinger]
> ...
> Also, have you ever put a colon in the wrong place?
>
> if x and y else: z
>
> This is currently valid, but has an entirely different
> meaning.
I'm not sure that raising SyntaxError counts as a valid entirely different
meaning <wink>. Seriously, that has no meaning now.
if x and y else z
:if x and y else z
if x: and y else z
if x and: y else z
if x and y: else z
if x and y else: z
if x and y else z:
are all SyntaxErrors now. Presumably only the last would grow a meaning
under Holger's suggestion.
Using a conditional as an if's test expression is likely unreadable no
matter how it's spelled, though. I really can't make head or tail out of
if if x: y else: z:
at first (or second, or third) glance either.
More information about the Python-list
mailing list