No Do while/repeat until looping construct in python?
Andy Freeman
anamax at earthlink.net
Fri Mar 14 11:36:42 EST 2003
"Greg Ewing (using news.cis.dfn.de)" <me at privacy.net> wrote in message news:<b4rkcq$22tehe$1 at ID-169208.news.dfncis.de>...
> Alex Martelli wrote:
> > Yes. Having a single loop construct as Knuth suggested many decades
> > ago, e.g.:
> >
> > repeat:
> > <pre-code>
> > while <test>:
> > <post-code>
> And this is *such* a common looping pattern that I really
> don't understand why *no* language I can remember seeing
> has explicit support for it.
Common Lisp's "loop" construct does.
> I think it's a somewhat bigger deal than you make out,
> since it would bring the exit condition into a prominently
> visible place, instead of being buried and easy to miss
> at first glance.
In most not-Python languages, it's possible to get most of
that prominence by outdenting the "if <test> break;".
While I'm very sympathetic with the prominence argument, I've
never seen anyone outdent "middle breaks". I won't do it
because said outdenting makes indentation less useful as a
structural clue; it forces readers to recognize keywords
instead of just looking at shape.
More information about the Python-list
mailing list