statements in control structures (Re: Conditional Expressions don't solve the problem)
use-net at schabi.de
Fri Oct 19 08:40:40 CEST 2001
> Thanks for finding some concrete, realistics examples of what the
> proposed change would lead to.
That's correct, the examle was worse than the original.
A genious one-liner is not always better than five lines of readable code.
> To me, that 'while' line is convincing
> evidence againt this syntax. What bothers me is this. ';' is a
> statement separator (whose use is generally discouraged). What the
> proposed change means is that a 'while' at the beginning of the
> sequence means that the last statement is instead to be a condition.
> This requires a sort of mental suspension that I believe many besides
> me would find obnoxious.
This is why I'd vote for something like:
do some; statements while condition:
pass #This could be your code
I know this involves a new keyword, and it might be difficult to get the parser parse this (as the do-while would be one statement containing ;-separated statements), but the code is executed in the same order as it is written, and ; really divides statements.
Maybe this form could be expanded to allow:
Making the last part optional (or inserting pass), we also would get the "check condition at end of loop" case.
You don't have to be Microsoft to suck... but it helps.
(Tim Hammerquist in comp.lang.python)
More information about the Python-list