title: Inherit a sub method in Python
body: <p>I would like inherit a 'submethod' of a method in python. Could somebody help me to figure out how to do this please ?</p>
  
  <p>Example of what I want to do : </p>
  
  <pre><code> class A(object):
      def method(self, val):
          def submethod():
              return "Submethod action"
          if not val:
              return submethod()  
          return "Method action"
  
  
  a = A()
  
  class B(A):
      def method(self, val):
          #inherit submethod ?        
          def submethod():
              return "Another submethod action"
  
          return super(B,self).method(val)
  
  b = B()
  print "A : "
  print a.method(True)
  &gt;&gt; Method action
  print a.method(False)
  &gt;&gt; Submethod action
  print "B : "
  print b.method(True)
  &gt;&gt; Method Action
  print b.method(False)
  Actual answer : 
  &gt;&gt; Submethod Action
  **Wanted answer : 
  &gt;&gt; Another submethod action**
  </code></pre>
  
  <p>Kind regards,</p>
  
  <p>Quentin</p>