Created
March 5, 2016 15:44
-
-
Save keenhenry/395c9e187cf0c706c8c9 to your computer and use it in GitHub Desktop.
A small script to print out the Exception inheritance hierarchy. Useful for writing exception handling (Python 2.5+)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def classtree(cls, indent=0): | |
print '.' * indent, cls.__name__ | |
for subcls in cls.__subclasses__(): | |
classtree(subcls, indent + 3) | |
classtree(BaseException) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment