Skip to content

Instantly share code, notes, and snippets.

@xtotdam
Last active October 2, 2015 12:21
Show Gist options
  • Select an option

  • Save xtotdam/229246ed8bc0b187ef0a to your computer and use it in GitHub Desktop.

Select an option

Save xtotdam/229246ed8bc0b187ef0a to your computer and use it in GitHub Desktop.
def print_attributes(obj, v=True):
'''v = verbose'''
m = {'instancemethod':'()', 'method-wrapper':'()', 'builtin_function_or_method':'()b'}
for i in dir(obj):
t = str(type(obj.__getattribute__(i))).split('\'')[1]
if not v:
if not i.startswith('__'):
print i+m[t] if t in m.keys() else i, '\t'*(4 - (len(i)+1)/8), '' if t in m.keys() else t
else:
print i+m[t] if t in m.keys() else i, '\t'*(4 - (len(i)+1)/8), '' if t in m.keys() else t
def pa(o, v=True):
print_attributes(o, v=v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment