title: How to determine an instance method's corresponding class?
body: <p>for example, I have this code, (new style class):</p>
  
  <pre><code>class B:
      def func(self):
          # do something to instance of type B
          pass
  
  class A:
     def __init__(self, random_variable):
         if random_variable &gt; 0:
             self.func = B().func
         else:
             pass
  
     def func(self):
         # do something to instance of type A
         pass
  
  a = A(random_variable)
  </code></pre>
  
  <p>How to determine whether <code>func</code> attribute of instance <code>a</code> binds originally to B or to A, without checking the value of random variable?</p>