Python 2.6.5 (r265:79063, Oct 1 2012, 22:07:21) [GCC 4.4.3]
>>> class myclass:
... def func(self):
... pass
>>> dd = myc
This is because the methods on a class (old or new) work really like attributes with the descriptor __get__ method; On python 2 the code
foo = FooClass.bar_method
is analogous to
import types
foo = types.MethodType(FooClass.__dict__['bar_method'], None, FooClass)
It will create a new instance of instancemethod(bar_method, None, FooClass) on each access. The original function is available as FooClass.bar_method.im_func and the class instance in foo.im_class. The type for both bound and unbound methods is the same instancemethod; if the im_self member is None, the instancemethod instance has the repr , whereas if im_self member is not None, the repr is
Python 3 is different. Unbound methods have a repr and the id is always the same, that is they are just general functions. In Python 3 you can pass anything for self of an unbound undecorated method, even None, it is just a function with a dot in its name.