Python Wrap Class Method

前端 未结 4 1660
逝去的感伤
逝去的感伤 2021-02-07 18:05

I\'m trying to create an object with a run method that will be wrapped by a _wrap_run method. I\'d like to be able to call the method and it\'s wrapper by simply ty

4条回答
  •  攒了一身酷
    2021-02-07 18:46

    What you have there is basically a decorator, so why not go ahead and implement _wrap_run as a decorator and apply it when subclassing the function?

提交回复
热议问题