Python: Decorate a Method That Gets Passed the Class Instance
The other day I needed to decorate a method with a decorator class that knows about the owner of the method meaning the instance. This works as expected with function decorators:
def some_decorator(func): def decorator(self, *args, **kwargs): print 'instance %s of class %s is now decorated whee!' % ( self ...
