Can one write something like:
class Test(object):
def _decorator(self, foo):
foo()
@self._decorator
def bar(self):
pass
This fails: self in @self is unknown
I also tried:
@Test._decorator(self)
which also fails: Test unknown
I would like to temporarily change some instance variables in the decorator and then run the decorated method, before changing them back.