title: In Python, is it possible to decorate both a class and non-class method with the same decorator?
body: <p>I have a simple exception-logging decorator, which is handy for sending myself emails when my scripts throw exceptions.</p>
  
  <pre><code>def logExceptions(func):
     def wrapper():
        try:
           func()
        except Exception, e:
           logger.exception(e)
  
     return wrapper
  </code></pre>
  
  <p>However, if I want to decorate a class method, I have to modify wrapper() to take a 'self', otherwise I get the following error:</p>
  
  <pre><code>TypeError: wrapper() takes no arguments (1 given)
  </code></pre>
  
  <p>Of course, at that point I can't use it to decorate any non-class methods, because then this error occurs:</p>
  
  <pre><code>TypeError: wrapper() takes exactly 1 argument (0 given)
  </code></pre>
  
  <p>Is there a clean way to tackle this problem? Thank you =)</p>