[Python-Dev] Pre-PEP: Unifying try-except and try-finally
Skip Montanaro
skip at pobox.com
Wed May 4 22:27:33 CEST 2005
Tim> What about `else` mixed with try/except/finally?
Tim> try:
Tim> A
Tim> except:
Tim> B
Tim> else:
Tim> C
Tim> finally:
Tim> D
Tim> If A executes without exception, does D execute before or after C?
According to Guido, execution is A, C, D in the normal case and A, B, D in
the exceptional case. Execution never jumps back.
Tim> I'm not saying we can't make up reasonable answers. I'm saying
Tim> they look more-or-less arbitrary, while the current nested forms
Tim> are always clear.
As far as arbitrary answers go, execution only in the forward direction
seems more reasonable than jumping forward and back.
Skip
More information about the Python-Dev
mailing list