The logical execution of try/except/finally/else goes as follows:
try:
...
except:
...
else:
...
finally:
...tryblock gets executed- If
tryblock executes successfully,elseblock starts execution. - If
tryblock raises anexception:- Exception gets saved and
finallyblock gets executed.exceptiongets raised if it wasn’t handled- If
finallyblock returns ->exceptiongets suspended - If
finallyraises an exception, the saved exception will be raised in the context of the new exception
- Exception gets saved and