Good python equivalent to C goto

Thomas Mlynarczyk thomas at mlynarczyk-webdesign.de
Sat Aug 16 17:29:46 EDT 2008


Kurien Mathew schrieb:

> Any suggestions on a good python equivalent for the following C code:
> 
> while (loopCondition)
> {
>     if (condition1)
>         goto next;
>     if (condition2)
>         goto next;
>     if (condition3)
>         goto next;
>     stmt1;
>     stmt2;
> next:
>     stmt3;
>     stmt4;
>  }

while loopCondition:
     if not( cond1 or cond2 or cond3 ):
         stmt1
         stmt2
     stmt3
     stmt4

Not tested.
Greetings,
Thomas

-- 
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)



More information about the Python-list mailing list