title: Python: Get name of instantiating class?
body: <p>Example:</p>
  
  <pre><code>class Class1:
      def __init__(self):
          self.x = Class2('Woo!')
  
  class Class2:
      def __init__(self, word):
          print word
  
  meow = Class1()
  </code></pre>
  
  <p>How do I derive the class name that created the self.x instance? In other words, if I was given the instance self.x, how do I get the name 'Class1'? Using <code>self.x.__class__.__name__</code> will obviously only give you the Class2 name. Is this even possible? Thanks.</p>