title: Extending the behavior of an inherited function in Python
body: <p>Let's say we have the following classes:</p>
  
  <pre><code>class Base(object):
  
      def load(self):
          # do logic A
  
          # do logic B
  
  class Child(Base):
  
      def load(self):
          # do logic C
  </code></pre>
  
  <p>I know decorators can be used to extend function behavior in Python but I don't know how I can apply it in my case.
  When <code>Child's</code> <code>load()</code> is called, how can I get the following code executions in this order?:</p>
  
  <pre><code>logic A
  
  logic C
  
  logic B
  </code></pre>
  
  <p>What <strong>I don't</strong> want to do</p>
  
  <pre><code>class Base(object)
  
      def logicA()
         pass
  
      def logicB()
         pass
  
      def load()
         pass
  
  class Child(Base):
  
      def load(self):
          super.logicA()
  
          # do logic C
  
          super.logicB()
  </code></pre>
  
  <p>I just want to code up logic C, without having to explicitly call logic A and B</p>