[Python-Dev] Pre-PEP: Unifying try-except and try-finally

Tim Peters tim.peters at gmail.com
Wed May 4 22:14:23 CEST 2005


[Reinhold Birkenfeld]
> ...
> I think the behaviour of the "else" clause is much harder to guess,
> mainly when used with the looping constructs.

No, that's obvious <wink>.

What about `else` mixed with try/except/finally?

try:
    A
except:
    B
else:
    C
finally:
    D

If A executes without exception, does D execute before or after C?

I'm not saying we can't make up reasonable answers.  I'm saying they
look more-or-less arbitrary, while the current nested forms are always
clear.


More information about the Python-Dev mailing list