When a function contains multiple if statements, it seems to be a good practice to keep only one exit. In php-like language, I can use do-while(false), like this:
function a() {
    do {
        if (...) break;
        ...
        if (...) break;
        ...
    } while (FALSE);
    ...
    return;
}
how to do this in python? Although I can use while(true), if missing the trailing break, it'll be a dead loop.
while True:
    if ...: break
    ...
    if ...: break
    ...
    # oops, miss the 'break', you're dead
Is there a more pythonic way to do this?
PS: to further illustrate the one-exit:
function a() {
    if (...) { $a = 1; log($a); return $a; }
    if (...) { $a = 2; log($a); return $a; }
    if (...) { $a = 3; log($a); return $a; }
}
function a() {
    do {
        if (...) { $a = 1; break; }
        if (...) { $a = 2; break; }
        if (...) { $a = 3; break; }
    } while (FALSE);
    log($a);
    return $a;
}
hope you see the difference...
 
     
     
     
    