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

Jan Kaliszewski zuo at chopin.edu.pl
Sat Jul 18 14:01:46 CEST 2009


Michael Foord <fuzzyman at gmail.com> wrote:

> I was surprised - I *thought* the semantics of finally were well defined;
> that exceptions inside the try block will be propagated unless a new
> exception is raised inside the finally. That return (and break it
> transpires) silently and implicitly swallow those exceptions is  
> surprising.
>
> It is also *odd*. If you *want* behavior then it is trivial to use an  
> except instead of a finally, so I don't see a use case for it.

+1 and even more.

-- 
Jan Kaliszewski <zuo at chopin.edu.pl>



More information about the Python-ideas mailing list