[Python-Dev] PEP 315 - do while

Ron Adam rrr at ronadam.com
Tue Oct 3 21:34:59 CEST 2006

Nick Coghlan wrote:
> Fuzzyman wrote:
>> Nick Coghlan wrote:
>>> In my example, the 3 sections (<setup code>, <loop body> and <loop completion 
>>> code> are all optional. A basic do-while loop would look like this:
>>>       do:
>>>           <setup code>
>>>           while <condition>
>>> (That is, <setup code> is still repeated each time around the loop - it's 
>>> called that because it is run before the loop evaluated condition is evaluated)
>> +1
>> This looks good.
> I'm pretty sure it was proposed by someone else a long time ago - I was 
> surprised to find it wasn't mentioned in PEP 315.
> That said, Guido's observation on PEP 315 from earlier this year holds for me too:
>   "I kind of like it but it doesn't strike me as super important" [1]

I looked though a few files in the library for different while usage patterns
and there really wasn't as many while loops that would fit this pattern as I
expected. There are much more while loops with one or more exit conditions in
the middle as things in the loop are calculated or received.

So it might be smart to find out just how many places in the library it would
make a difference.


More information about the Python-Dev mailing list