why no "do : until"?

Andrew Henshaw andrew_dot_henshaw_at_earthling_dot_net
Thu Jan 11 22:18:46 EST 2001


"D-Man" <dsh8290 at rit.edu> wrote in message
news:mailman.979261813.31482.python-list at python.org...
> On Fri, Jan 12, 2001 at 12:33:58AM +0000, Robert Amesz wrote:
> [snip]
...snip
> | As I prefer programming languages to be as context-free as possible,
> | I'd like to make a counter-proposal:
> |
> |      do:
> |           something
> |           until condition
> |           something else
> |
>
> This also breaks the indent-denotes-block-structure style.  Is the
> "until" clause really a part of the "something" block?  If it is
> adopted I think it ought to stand out more tying it more closely to
> the "do".  I wouldn't mind if, say, the until was to recieve a
> half-indent (or half-dedent depending on your view) as compared to the
> "something" and "something else" blocks.

...snip...
An admirable idea, but I fear that it is much too exotic to ever be
approved.  I'm in agreement about the block structure problem, however.

In my opinion, allowing an 'until' to roam about the loop, will never fit
with Python's indentation design.  It's not clear what is controlled by the
statement.

Oh the other hand, I'm all for the introduction of 'do'.  It's much cleaner
(to me) and simpler then 'while 1'. Also, I feel that beginners would grasp
it more quickly ("while 1?, while 1 what? shouldn't there be a conditional
on this line?").  Therefore, I propose, for these cases that Python simply
support:

do:
    something
    if condition: break
    something else

Python's existing 'if condition: break', with its colon, stands out and,
more clearly than the 'until', shows its true function; which is,
essentially, a goto past 'something else' and out of the loop.  I believe
that support for this is more likely than for the other more significant
changes.

AH






More information about the Python-list mailing list