Skip to content

Instantly share code, notes, and snippets.

@thorsummoner
Created August 13, 2016 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thorsummoner/bf0142fd24974a0ced778768a33a3069 to your computer and use it in GitHub Desktop.
Save thorsummoner/bf0142fd24974a0ced778768a33a3069 to your computer and use it in GitHub Desktop.
hell debugger
import inspect
depth = 0
def props(obj):
global depth
depth += 1
pr = {}
for name in dir(obj):
try:
value = getattr(obj, name)
if not name.startswith('__') and not inspect.ismethod(value):
pr[name] = value
if value.__repr__().startswith('<') and depth < 5:
pr[name] = props(value)
except Exception as err:
print(err)
continue
depth -= 1
return pr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment