title: Test an object is a subclass of the type of another instance
body: <p>I have this code:</p>
  
  <pre><code>class Item:
      def __init__(self,a):
          self.a=a
  
  class Sub(Item):
      def __init__(self,a,b):
          self.b=b
          Item.__init__(self,a)
  
  class SubSub(Sub):
      def __init__(self,a,b,c):
         self.c=c
         Sub.__init__(self,a,b)
  
  obj1=Item(1)
  obj2=Sub(1,2)
  obj3=SubSub(1,2,3)
  </code></pre>
  
  <p>Now I want to check if <code>obj2</code> and <code>obj3</code> are instances of classes that are subclasses of <code>obj1</code> as well as simply subclasses of of <code>Item</code>.</p>
  
  <p>Here is what I understand, I know that I can use the <code>isinstance()</code> to find if <code>obj2</code> is <code>Sub</code>. and I know that I can use <code>issubclass(Sub, Item)</code>. But let's say I didn't know what class <code>obj2</code> was.</p>
  
  <p>I tried using <code>issubclass(type(obj2),Item)</code> but that doesn't work, because <code>type()</code> returns a separate object that I don't really understand the workings of. And this is just one problem, although I figure that the answer to this question will help me solve some of the other problems that I am having.</p>
  
  <p>Also I have tried using some of the special attributes to do this such as <code>__class__</code> but I can't figure out how to do that either.</p>