[Python-ideas] Make return inside a finally a SyntaxError

Stephen J. Turnbull stephen at xemacs.org
Sat Jul 18 14:54:38 CEST 2009


Michael Foord writes:

 > That exceptions can be silently swallowed in a finally block (which
 > is 'expected' and usually intended to propagate exceptions)

I would say "intended to be executed regardless of control transfer
out of the try block".

 > in the presence of a return (or a break apparently) is worrying.

 > Another solution would be to have the exception raised instead of
 > swallowed.

That would really piss off anybody who deliberately put a return in a
finally block, I think.




More information about the Python-ideas mailing list