do while loop
Rick Zantow
rzantow at gmail.com
Wed Apr 26 17:35:35 EDT 2006
Marc 'BlackJack' Rintsch <bj_666 at gmx.net> wrote in
news:pan.2006.04.26.20.41.03.189115 at gmx.net:
> In <1146012542.166096.78690 at g10g2000cwb.googlegroups.com>, é· wrote:
>
>> suggest add do while loop in later version
>
> Please also suggest a clean syntax for this. :-)
>
Since Python already has a while <condition>: loop, I'm supposing you
mean something like
do:
<some code>
while <not condition>
or
do:
<some code>
until <condition>
Is that what you mean? In some languages that might be a "do x until y"
loop, which I would suppose has been proposed before for Python. A
clean syntax might be
until <condition>:
<some code>
... except that people seem to object to placing the condition
specification so far from where the test would actually take place (at
the bottom of the loop). I don't have a problem with that, but I can see
why many would. It doesn't seem Pythonic somehow.
There was a long thread about a loop-and-a-half construction where some
of this was discussed, though I don't have a link for that.
In any case, what would you want to do that you can't do (in some way)
now? If you have a compelling use case, you could get a bit more
attention than merely offering a suggested expansion of the language.
--
rzed
More information about the Python-list
mailing list