title: Python subclass inheritance
body: <p>I am trying to build some classes that inherit from a parent class, which contains subclasses that inherit from other parent classes. But when I change attributes in the subclasses in any children, the change affects all child classes. I am looking to avoid having to create instances, as I am using that feature later. </p>
  
  <p>The code below boils down the problem. The final line shows the unexpected result.</p>
  
  <pre><code>class SubclsParent(object):
      a = "Hello"
  
  class Parent(object):
      class Subcls(SubclsParent):
          pass
  
  class Child1(Parent):
      pass
  
  class Child2(Parent):
      pass
  
  Child1.Subcls.a # Returns "Hello"
  Child2.Subcls.a # Returns "Hello"
  Child1.Subcls.a = "Goodbye"
  Child1.Subcls.a # Returns "Goodbye"
  Child2.Subcls.a # Returns "Goodbye" / Should still return "Hello"!
  </code></pre>