title: Python Wrap Class Method
body: <p>I'm trying to create an object with a run method that will be wrapped by a <code>_wrap_run method</code>. I'd like to be able to call the method and it's wrapper by simply typing <code>instance.run()</code> and I'd like to be able to subclass the object so I can override the <code>run()</code> method and have it still execute the wrapper.  </p>
  
  <p>More simply put, I want people to be able to subclass A and override <code>run()</code> but still have calls to the <code>run()</code> method execute the wrapper function.  </p>
  
  <p>I'm having some difficulty with the mechanics of this. Does anyone have any suggestions regarding this approach?</p>
  
  <pre><code>class A:
  
      def run(self):
          print "Run A"
          return True
  
      def _wrap_run(self):
          print "PRE"
          return_value = self.run()
          print "POST"
          return return_value
  
      run = property(_wrap_run)
  
  
  a = A()
  a.run()
  """
  Should Print: 
  PRE
  Run A
  POST
  """
  
  
  class B(A):
  
      def run(self):
          print "Run B"
          return True
  
  b = B()
  b.run()
  """
  Should Print: 
  PRE
  Run B
  POST
  """
  </code></pre>