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

Michael Foord fuzzyman at gmail.com
Sat Jul 18 15:06:54 CEST 2009


2009/7/18 Stephen J. Turnbull <stephen at xemacs.org>

> 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.
>
>
I think the current behavior (swallowing an exception that most people would
expect to be re-raised) surprises and pisses people off. Guido has already
made a pronouncement so not much point continuing this discussion.

Michael

-- 
http://www.ironpythoninaction.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090718/e090b9f4/attachment.html>


More information about the Python-ideas mailing list