a.__get__ is a way to bind a function to an object. In this way:
class C(object): pass def a(s): return 12 a = a.__get__(C)
is the gross equivalent
class C(object): def a(self): return 12
(Although it is not good to do so: on the one hand, C will not know that it has a related method a , which you can confirm by running dir(C) . In principle, __get__ only performs one part of the binding process).
This is why you cannot do this for a function that takes no arguments - it must accept this first argument (traditionally self ), which passes a particular instance.
source share