Your example code is pointless, but if you wanted to perform logging or cleanup that only occurs on failure, you could put that between the except: and the raise and you'd do that work and then proceed as if the original exception was bubbling normally.