This post originated from an RSS feed registered with Python Buzz
by Ian Bicking.
Original Post: Re-raising Exceptions
Feed Title: Ian Bicking
Feed URL: http://www.ianbicking.org/feeds/atom.xml
Feed Description: Thoughts on Python and Programming.
After reading Chris McDonough’s What Not To Do When Writing Python Software, it occurred to me that many people don’t actually know how to properly re-raise exceptions. So a little mini-tutorial for Python programmers, about exceptions…
First, this is bad:
try:
some_code()
except:
revert_stuff()
raise Exception("some_code failed!")
It is [...]