a gap of do....while?

Chris Rebert clp2 at rebertia.com
Sun Oct 18 01:36:49 EDT 2009


On Sat, Oct 17, 2009 at 10:34 PM, Chris Rebert <clp2 at rebertia.com> wrote:
> On Sat, Oct 17, 2009 at 10:22 PM, StarWing <weasley_wx at sina.com> wrote:
<snip>
>> but in python, we only can:
>> cond = 1
>> while cond:
>>    cond = 0
>>    .....
>>    if ....: cond = 1
>>
>> has any polite way to handle this?
>
> It's essentially the same:
>
> while True:
>    ...
>    if not cond: break

Substituting in the appropriate conditional expression for cond of
course (your use of cond for the flag caught me off guard).

Cheers,
Chris



More information about the Python-list mailing list