why no "do : until"?
Martijn Faassen
m.faassen at vet.uu.nl
Sat Dec 30 22:52:46 EST 2000
Peter Hansen <peter at engcorp.com> wrote:
[snip]
> I suspect some of us would even argue that the conditional in 'do/until'
> can be difficult for some people to get right and that forcing the use of
> 'while/if/break' may actually increase the likelihood the resulting code
> will be correct the first time, and be interpreted correctly during
> maintenance. My guess is that for this precise reason the alternative
> loop construct was removed from/never added to Python in the first place.
I suspect (and seem to recall hearing about this before) the reason is
more prosaic; how does one indent the darn thing? :)
do:
..
until x > 25
does not fit a pythonic pattern for statements.
do:
..
until x > 25
doesn't either, unless 'until' is a new statement. But to fit the Python
pattern, it'd need to be usable at least anywhere within the loop, and
in that case it's just a synonym for:
if x > 25: break
which we already have.
Regards,
Martijn
--
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?
More information about the Python-list
mailing list