Skip to content

Instantly share code, notes, and snippets.

@skimbrel
Created October 22, 2013 21:44
In [1]: class Foo(object):
...: pass
...:
In [2]: def bar(self):
...: pass
...:
In [3]: bar.__get__
Out[3]: <method-wrapper '__get__' of function object at 0x10fdc6398>
In [4]: bar
Out[4]: <function __main__.bar>
In [5]: Foo.bar = bar
In [6]: Foo.bar.__get__
Out[6]: <method-wrapper '__get__' of instancemethod object at 0x10f8ef870>
In [7]: Foo.bar
Out[7]: <unbound method Foo.bar>
In [8]: f = Foo()
In [9]: f.bar.__get__
Out[9]: <method-wrapper '__get__' of instancemethod object at 0x10f8ef820>
In [10]: f.bar
Out[10]: <bound method Foo.bar of <__main__.Foo object at 0x10fdc7250>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment