title: Can a Python inner class be a subclass of its own outer class?
body: <p>This...</p>
  
  <pre><code>class A(object):
      class B(A):
          def __init__(self):
              pass
  </code></pre>
  
  <p>... throws "NameError: name 'A' is not defined".</p>
  
  <p>Is there proper syntax to accomplish this, or must I use workarounds, like this?</p>
  
  <pre><code>class A(object):
      pass
  class _B(A):
      pass
  A.B = _B
  </code></pre>
  
  <p>The prior is strongly preferable.  Thank you.</p>