why no "do : until"?

Steve Williams sandj.williams at gte.net
Fri Jan 12 10:38:38 EST 2001


Andrew Henshaw wrote:

> "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
> [more snip]

>
> 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.
>

If you have nested 'do' statements, you have to keep track of the nesting
structure to find a break target.  Searching for the first 'break' after a 'do'
may or may not find the loop invariant.

Similarly, if you have multiple 'breaks' for a single 'do', the first one you
find may not be the one that bit you.

With 'break', the program flow no longer corresponds to the program listing
(the original complaint about g*t*, IIRC).

There will always be debugging questions such as "how did I get here?" and "why
did I skip this?" in procedural languages.  'Break' adds a little extra
excitement to these questions.





More information about the Python-list mailing list