Kurien Mathew wrote:
Hello,

Any suggestions on a good python equivalent for the following C code:


There are various ways to write your example in Python. For example

while loopCondition:
    condition = 1
    while condition:
        if condition1:
            break
        if condition2:
            break
        if condition3:
            break
        stmt1
        stmt2
        condition = 0
    else:
        stmt3
        stmt4

The else block of while isn't execute if you break out of while.

You can emulate multiple gotos with exceptions. In general you shouldn't try to mimic C in Python code. C like Python code is often hard to read and slower than well designed Python code.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to