I found the following behavior at least weird:
def errors():
try:
ErrorErrorError
finally:
return 10
print errors()
# print
The exception disappears when you use
returninside afinallyclause. .. Is that documented anywhere?
It is:
If finally is present, it specifies a ‘cleanup’ handler. The try clause is executed, including any except and else clauses. If an exception occurs in any of the clauses and is not handled, the exception is temporarily saved. The finally clause is executed. If there is a saved exception, it is re-raised at the end of the finally clause. If the finally clause raises another exception or executes a return or break statement, the saved exception is lost.