Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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