Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 1
    is there a way to get the python 3 behaviour in python 2? Commented Dec 15, 2019 at 13:40
  • I personally find the python 3 behavior somewhat opinionated in a wrong way (better have let the catcher decide whether to log the exception they captured or not) and also not consistent with catching without re-raising. The python 3 text "During handling" showing between every two exceptions in the chain of exception captures is quite exacerbating on this tangent. The extended syntax from the other answer side-steps this dubious message, while still making you emit a stacktrace hierarchy of exceptions even if you are fine with only the final one that you choose to raise. Commented Feb 12, 2024 at 17:29