title: Python Decorators and inheritance
body: <p>Help a guy out.  Can't seem to get a decorator to work with inheritance.  Broke it down to the simplest little example in my scratch workspace.  Still can't seem to get it working.</p>
  
  <pre><code>class bar(object):
      def __init__(self):
          self.val = 4
      def setVal(self,x):
          self.val = x
      def decor(self, func):
          def increment(self, x):
              return func( self, x ) + self.val
          return increment
  
  class foo(bar):
      def __init__(self):
          bar.__init__(self)
      @decor
      def add(self, x):
          return x
  </code></pre>
  
  <p>Oops, name "decor" is not defined.  </p>
  
  <p>Okay, how about <code>@bar.decor</code>? TypeError: unbound method "decor" must be called with a bar instance as first argument (got function instance instead)</p>
  
  <p>Ok, how about <code>@self.decor</code>?  Name "self" is not defined.</p>
  
  <p>Ok, how about <code>@foo.decor</code>?! Name "foo" is not defined.</p>
  
  <p>AaaaAAaAaaaarrrrgggg...  What am I doing wrong?</p>