title: python decorator for class method and static method?
body: <p>I am trying to write a decorator for an instance method, as follows:</p>
  
  <pre><code>from functools import wraps
  
  def plus_decorator(f):
      @wraps(f)
      def wrapper(*args, **kwargs):
          return 1 + f(*args, **kwargs)
      return wrapper
  
  @plus_decorator
  def return_i(i):
      return i
  
  class A(object):
      @plus_decorator
      def return_i(self, i):
          return i
  
      @plus_decorator
      @classmethod
      def return_i_class(cls, i):
          return i
  
      @plus_decorator
      @staticmethod
      def return_i_static(i):
          return i
  
  if __name__ == '__main__':
      print return_i(1)
      a = A()
      print a.return_i(1)
      print A.return_i_class(1)
      print A.return_i_static(1)
  </code></pre>
  
  <p>However, it pops up the error:</p>
  
  <pre><code>AttributeError: 'classmethod' object has no attribute '__module__'
  </code></pre>
  
  <p>I am wondering why the decorator does not work on <code>classmethod</code> and <code>staticmethod</code>. I think the decorator mostly just passes all the parameters it receives to the wrapper, and only modifies the result. How can I modify the decorator to make it work for <code>classmethod</code> and <code>staticmethod</code>?</p>