title: Access local variables of overridden parent method
body: <p>How can I access the local variables of a super class method in an overridden method in the subclass? </p>
  
  <pre><code>class Foo(object):
      def foo_method(self):
          x = 3
  
  class Bar(Foo):
      def foo_method(self):
          super().foo_method()
          print(x) # Is there a way to access x, besides making x an attribute of the class?
  </code></pre>
  
  <p>The code below gives a <code>NameError: name 'x' is not defined</code></p>
  
  <pre><code>bar = Bar()
  bar.foo_method()
  </code></pre>
  
  <p>This isn't surprising, and it can be fixed by making <code>x</code> an instance attribute, but can <code>x</code> be accessed as-is in <code>Bar.foo_method</code> more directly?</p>