why no "do : until"?

Andrew Henshaw andrew_dot_henshaw_at_earthling_dot_net
Wed Jan 10 22:46:59 EST 2001


<gregory_wilson at my-deja.com> wrote in message
news:93i12s$ul5$1 at nnrp1.deja.com...
>
> > Can someone point me at an explanation of the logic for not having
> > do:
> > until
>
> A proposal I floated a year ago, based on feedback from students in
> the Python course I teach, was:
>
>     do:
>       first-half
>     while cond:
>       second half
>
...snip...

I almost like this, but it appears to me that it could be a maintenance
headache.  If you have a significant amount of code done in 'first-half'
then it would be easy for someone inspecting your code to focus on

while cond:
    second half

as being an entire loop, not realizing that control was returning to the top
of the loop way up in the code.  This would mean that every time you looked
at a while loop that was below an indented block, you'd have to check the
top of that indent for a 'do:' statement.

I wish I could make a counter-proposal; because, as I said, I almost like
this idea.

Andrew Henshaw





More information about the Python-list mailing list