Skip to content

Instantly share code, notes, and snippets.

@tfiers
Created July 8, 2017 09:46
Show Gist options
  • Save tfiers/fff73d1c496212db62536ffa0db8ff4d to your computer and use it in GitHub Desktop.
Save tfiers/fff73d1c496212db62536ffa0db8ff4d to your computer and use it in GitHub Desktop.
Inspect a python object when there is no documentation (or help(obj)) available.
from pprint import pformat
from tabulate import tabulate
rows = []
for name in dir(obj):
val = getattr(obj, name)
if callable(val):
try:
content = val()
except:
content = '/'
else:
content = val
rows.append((name, pformat(content)))
print(tabulate(rows))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment