try/except/finally

Chris Angelico rosuav at gmail.com
Sat Jun 7 19:47:21 EDT 2014


On Sun, Jun 8, 2014 at 8:49 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
> I don't remember if I almost had this in real code or if I learned about it
> first, but it can definitely be a gotcha. It seems to me that if the try
> block exits with an explicit return, and then the finally block exits with
> an explicit return, some kind of error ought to be raised.

I'd go a little simpler: A return statement inside a finally block is
code smell.

ChrisA



More information about the Python-list mailing list