No Do while/repeat until looping construct in python?

John Roth johnroth at ameritech.net
Thu Mar 13 07:49:25 EST 2003


"Lars W" <lw at hot-shot.com> wrote in message
news:b4mcsf$b5f$1 at lenny.tc.umn.edu...
> Hello!
>
> Why is there no do-while looping construct in Python?
> It seems to me that such a feature is very useful. Consider the
> following pseduocode:
>
> <code>
> while i<j:
> <code>
>
> Compared with an imaginary do-while loop like in C or Pascal:
>
> do:
> <code>
> while i<j
>
> Alternatively, the imaginary code could be written:
>
> repeat:
> <code>
> until i>=j
>
> <code> might be a large chunk of code which has to be run at
> least once before the evaluation of "i<j" is made. But Python
> forces you to write code on the first form.
>
> I might be missing something, but do-while is indeed a
> useful looping construct which users would benefit from using.

There's a common test to find out exactly how useful it
would be; this test will be done before the development team
spends any effort on implementing it.

Go through the library shipped with Python, and find out how
many places this construct could be used in the code. I won't
venture to make any predictions, but that exercise has demonstrated,
time and again, that the actual applicability of the proposed features
is
much less than the proponent thinks.

John Roth



> Regards
> Lars
> lw at hot-shot.com






More information about the Python-list mailing list