do ... while loop

Joshua Marcus josh at linc.cis.upenn.edu
Thu Oct 14 01:36:00 EDT 1999


Tim Peters (tim_one at email.msn.com) [illuminates the unenlightened]:
:     while 1:
:         xxx
:         yyy
:         if not condition:
:             break

ah-ha!  While it does immediately seem wordy, this does seem like a 
perfectly good idiom.  I'm half-convinced.

Still, what's the rejoinder to the following proposal?

do while condition:
    xxxx
    yyyy

or just

do condition:
   xxxx
   yyyy

...where the do while combo or simply do indicates that the loop should
be executed at least once.  Sure, it would be potentially *more* crisp 
if Python syntax used closing phrases-- but just because do...while's aren't 
ideal with whitespace bracketing doesn't mean that they should be 
... sniff ...rejected entirely.

i-suppose-now-would-be-a-bad-time-to-case-for-case-ly y'rs,
--j




More information about the Python-list mailing list