Last active
January 14, 2020 20:45
-
-
Save jamiebullock/d4d04aa1fe53e30bc6ab6e31170350b8 to your computer and use it in GitHub Desktop.
Introspection Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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