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, the saved exception is set as the context of the new exception. If the "finally" clause executes a "return", "break" or "continue" statement, the saved exception is discarded: >>> def f(): ... try: ... 1/0 ... finally: ... return 42 ... >>> f() 42 The exception information is not available to the program during execution of the "finally" clause. When a "return", "break" or "continue" statement is executed in the "try" suite of a "try"…"finally" statement, the "finally" clause is also executed ‘on the way out.’ The return value of a function is determined by the last "return" statement executed. Since the "finally" clause always executes, a "return" statement executed in the "finally" clause will always be the last one executed: >>> def foo(): ... try: ... return 'try' ... finally: ... return 'finally' ... >>> foo() 'finally' Additional information on exceptions can be found in section Exceptions, and information on using the "raise" statement to generate exceptions may be found in section The raise statement. Changed in version 3.8: Prior to Python 3.8, a "continue" statement was illegal in the "finally" clause due to a problem with the implementation. uz™