Doing cleaup in except is not the Python way. This is what finally is
for. Using except you would have to at least say:

try:
    stuff()
    cleanup()
except:
    cleanup()
    raise

Duplicate code - not nice. finally is the Python way:

try:
    stuff()
finally:
    cleanup()

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.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to