我有以下问题,我试图找到最适合Python的方法。我有一个解决办法,但它根本感觉不到Python的力量。也许你知道一个更优雅的解决方案?在
问题是
作为一个装修师,我想
decorator应该是所有函数类型的泛型,它们是staticmethod
、classmethod
、instance method
(带self)或{
假设我的项目如下:
import inspect
@the_decorator
def fun_method(name, password):
pass
class ExampleClass:
@staticmethod
@the_decorator
def static_method(name, password):
pass
@classmethod
@the_decorator
def class_method(cls, name, password):
pass
@the_decorator
def instance_method(self, name, password):
pass
我目前的解决方案
^{pr2}$
目前没有回答
相关问题 更多 >
编程相关推荐