I'm trying to find the name of the class that contains method code.
In the example underneath I use self.__class__.__name__, but of course this returns the name of the class of which self is an instance and not class that contains the test() method code. b.test() will print 'B' while I would like to get 'A'.
I looked into the inspect module documentation but did not find anything directly useful. 
class A:
  def __init__(self):
    pass
  def test(self):
    print self.__class__.__name__
class B(A):
  def __init__(self):
    A.__init__(self)
a = A()
b = B()
a.test()
b.test()