Passing a method of self to decorator as an argument
I think you can just pass A.new_func
. In the wrapper, self
will be one of the *args
, so it will be passed along correctly.
class A:
def __init__(self):
self.x = 1
@refactor_factory(A.new_func)
def old_func(self):
return 2
def new_func(self):
return 2