how to call a member function in python by its function instanceï¼
<p>Suppose we have the following code:</p>

<pre><code>class T(object):
  def m1(self, a):
    ...
f=T.m1
</code></pre>

<p>How to call f on an instance of T?</p>

<pre><code>x=T()
x.f(..)?
f(x, ..)?
</code></pre>

<p>Hopefully this explains it!</p>

<pre><code>class T(object):
    def m1(self, a):
        return a
f=T().m1 #must initialize the class using '()' before calling a method of that class
f(1)

f = T()
f.m1(1)

f = T().m1(1)

f = T
f().m1(1)

f = T.m1
f(T(), 1) #can call the method without first initializing the class because we pass a reference of the methods class

f = T.m1
f2 = T()
f(f2, 1)
</code></pre>

python