Python decorator as a staticmethod

前端 未结 4 1717
天涯浪人
天涯浪人 2020-11-28 10:42

I\'m trying to write a python class which uses a decorator function that needs information of the instance state. This is working as intended, but if I explicitly make the d

4条回答
  •  孤城傲影
    2020-11-28 10:46

    ensure_black is returning a _aux method that isn't decorated by @staticmethod

    You can return a non-static method to a static_method

    http://docs.python.org/library/functions.html#staticmethod

提交回复
热议问题