[Python-Dev] Wishlist: dowhile

Andrew Koenig ark-mlist at att.net
Tue Jun 14 20:48:03 CEST 2005


> > With PEP 315, a do-while loop would look like:
> >
> >    do:
> >        <body>
> >    while <cond>:
> >        pass

> > But then, I'm reasonably happy with the 'break out of an infinite
> > loop' approach, so *shrug*.

>  From Programming Languages 101 I remember this construct in Algol 68.
> It was then claimed to be *the* universal loop construct. If that is
> true __and__ it is easy to implement, I'd say +INF for PEP 315.

I believe that Algol 68 loops looked like the following (in somewhat more
Python-like terms):

	[for <identifier> [from <suite>] [step <suite>] to <suite>]
	[while <suite>]
	do <suite> od

where either "for" or "while" had to be present.  Note that in Algol 68, the
value of a "suite" (which I think they called a "serial clause") is the
value of the last expression in it.




More information about the Python-Dev mailing list