Best way to handle exceptions with try/finally

Carl J. Van Arsdall cvanarsdall at
Wed May 24 18:00:07 CEST 2006

Zameer wrote:
> That's it. But the return statement should not be a part of finally if
> you want exceptions to propagate out of the function containing
> try/finally. As mentioned multiple times in the thread.
Ah, great, that was it.  Thanks to everyone for their help, I got a lot 
of really useful information from your replies.  I tend to put "return" 
statements at the end of functions to make an attempt at being clean.  I 
realize that a lot of the time functions will just return but I was 
hoping by explicitly stating my function returns that another person 
reading my code would more easily see any exit points in my code.  Turns 
out that it came to bite me later.

Again, thanks to all your help and comments on my coding style. 



Carl J. Van Arsdall
cvanarsdall at
Build and Release
MontaVista Software

More information about the Python-list mailing list