After studying this issue Python. Calling a decorator inside a class
I decided to use this method to write a decorator inside a class. It checks the values of one method and, depending on the response, either performs the additional method or executes. To put this all into a separate method will not work, since such a construction must be applied to all other methods. But still crawling errors. Has anyone encountered similar problems?
class A: def __init__(self): pass def _refresh(func1,func2,func3): def checker(self): if func2: func3 func1 return checker def switcher(self): return True def prep(self): self.m = 100 def diver(self): self.m = self.m / 4 @_refresh(switcher(), diver()) def prep1(self): self.b=self.m/2