In the Python class, make a function of the adorner,
class A: def Wrapper (func): ## #装饰器 def wrapped (self,*arg,**Kwargs) ... return wrapped @ wrapper ## #装饰mix def Mix (): ...
When the mix is called, Self.mix () will pass parameters such as self into the wrapper? The answer is no.
when wrapper as a decorator and @wrapper this way as a decoration , wrapper is like a normal function, just receives the decorated function as a parameter, and does not pass on the adorner any additional parameters such as SELF,CLS, The class is the equivalent of a namespace.
Wrapper itself with @staticmethod, and @classmethod decorate, will come to error.
' Staticmethod ' Object is not callable ' Classmethod ' Object is not callable
Because the adorner must be an object that can be called, and Wrapper is @staticmethod, and after the @classmethod is decorated, it is not a callable object.
A function in the Python class as an adorner