Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A small script to print out the Exception inheritance hierarchy. Useful for writing exception handling (Python 2.5+)
#!/usr/bin/env python
def classtree(cls, indent=0):
print '.' * indent, cls.__name__
for subcls in cls.__subclasses__():
classtree(subcls, indent + 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.