No Do while/repeat until looping construct in python?

Erik Max Francis max at
Fri Mar 14 05:16:41 CET 2003

"Greg Ewing (using" wrote:

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

Indeed.  Most applications of do...while structures I can think of
seeing and using are actually of this form, and often emulate it with
something like (C):

	    ... pre code ...
	    if (test)
	        ... post code ...
	} while (test);

Other than just general lack of utility (you already have the structure
easily enough with while True and a break), I think the main aesthetic
reason it would be hard to add a
do...while/repeat...until/whatever...whatever structure is the
awkwardness of having two blocks as a fundamental part of some

	while condition

looks obnoxious through my Pythonic secret decoder glasses.

 Erik Max Francis / max at /
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Awards are merely the badges of mediocrity.
\__/ Charles Ives
    Rules for Buh /
 The official rules to the betting card game, Buh.

More information about the Python-list mailing list