Python 带参数注入的装饰器

Python 带参数注入的装饰器,python,Python,我想在另一个类的方法类上注入一个装饰器 我有以下界面: class Interface(object): __metaclass__ = abc.ABCMeta @abc.abstractmethod def run(self): """Run the process.""" return 我有一个使用接口的类 class Launch(Interface): def run(self): pass 我想

我想在另一个类的方法类上注入一个装饰器

我有以下界面:

class Interface(object):

    __metaclass__ = abc.ABCMeta


    @abc.abstractmethod
    def run(self):
        """Run the process."""
        return
我有一个使用接口的类

class Launch(Interface):

    def run(self):
        pass
我想做的是将接口类中具有参数的装饰器注入到启动类中

我试过使用,但没有成功


实现此功能的最佳方法是什么?

使用您的帮助,我创建了以下功能,用于检测是否实现:

  modpath = "C:/mypath"

            for modname in listdir(modpath):
                if modname.endswith(".py"):
                    # look only in the modpath directory when importing
                    oldpath, path[:] = path[:], [modpath]
                    if not modname[:-3]=="__init__":
                        module=__import__(modname[:-3])
                        if  not module.__dict__.has_key("ProcessInterface") :
                                print module.__name__

当你尝试使用Decorator injector但没有成功时,有什么特别失败的?我只是不知道如何实现这个技巧。我不明白你在尝试做什么,链接被破坏了,或者网站关闭了-是否还有其他链接,或者你能进一步解释你的目标是什么?一个具体的例子会有所帮助。