No Do while/repeat until looping construct in python?
Erik Max Francis
max at alcyone.com
Thu Mar 13 23:16:41 EST 2003
"Greg Ewing (using news.cis.dfn.de)" 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):
do
{
... 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
structure:
repeat:
statements
while condition
looks obnoxious through my Pythonic secret decoder glasses.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ Awards are merely the badges of mediocrity.
\__/ Charles Ives
Rules for Buh / http://www.alcyone.com/max/projects/cards/buh.html
The official rules to the betting card game, Buh.
More information about the Python-list
mailing list