No Do while/repeat until looping construct in python?

Alex Martelli aleax at
Mon Mar 17 09:10:38 CET 2003

Greg Ewing (using wrote:

> Evan Simpson wrote:
>> Someone (I forget who, sorry) recently pointed out a cute use of
>> line-continuation that could help here:
>> while 1:
>>     # some code
>>     # blah
>>     if all_done:\
>> break
>>     # more code
> This isn't quite the same thing, since although
> it certainly makes the "break" prominent, it
> doesn't do the same for the condition guarding
> it.

<shrug> so put the backslash/linebreak before the
"if" keyword, if you're so keen on physically
aligning the latter with the "while" keyword:

while 1:
if condition: break


More information about the Python-list mailing list