Skip to content

Instantly share code, notes, and snippets.

@jamiebullock
Last active January 14, 2020 20:45
Show Gist options
  • Save jamiebullock/d4d04aa1fe53e30bc6ab6e31170350b8 to your computer and use it in GitHub Desktop.
Save jamiebullock/d4d04aa1fe53e30bc6ab6e31170350b8 to your computer and use it in GitHub Desktop.
Introspection Function
class Test:
def __init__(self):
self.x = 1
self.y = 2
def introspect(obj):
for func in [type, id, dir, vars, callable]:
print("%s(%s):\t\t%s" % (func.__name__, introspect.__code__.co_varnames[0], func(obj)))
introspect(Test())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment