Skip to content

Instantly share code, notes, and snippets.

@andrewgodwin
Last active August 29, 2015 14:01
Show Gist options
  • Save andrewgodwin/f192a20e3b4cf0f5b5d8 to your computer and use it in GitHub Desktop.
Save andrewgodwin/f192a20e3b4cf0f5b5d8 to your computer and use it in GitHub Desktop.
Function Membership Introspection
class MyClass(object):
def a(self):
pass
b = [a]
# Get the reference to a from the list
a = MyClass.b[0]
# How do I get the class a was defined on? Is it even possible?
# On Python 3, I can use __qualname__. This isn't around on Python 2.
@vartec
Copy link

vartec commented May 21, 2014

@alexsv I've tried getting the code and the only thing you get is

    def a(self):
        pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment