decorator

Class decorator for methods from other class [duplicate]

最后都变了- 提交于 2020-08-25 09:18:32
问题 This question already has answers here : Decorating Python class methods - how do I pass the instance to the decorator? (3 answers) Closed 11 days ago . NOTE: I've got a related question here: How to access variables from a Class Decorator from within the method it's applied on? I'm planning to write a fairly complicated decorator. Therefore, the decorator itself should be a class of its own. I know this is possible in Python (Python 3.8): import functools class MyDecoratorClass: def __init__