How can I extend a library's decorator?
问题 I would like to extend a library's decorator. I know that I can just call both decorators: @my_decorator @lib_decorator def func(): pass But I would like to avoid having to pass @lib_decorator to each function each time. I would like my decorator to automatically decorate func() with lib_decorator . How can I do this? Can they be nested? 回答1: You can incorporate the lib's decorator within yours. For simple, argument-less decorators, it's rather straight-forward: def my_decorator(): @lib