将@classmethod与@property一起使用

时间:2017-03-25 14:24:15

标签: python

我只是想知道是否有可能做出这样的事情:

class Base:
    __interface__ = BaseInterface        

    @classmethod
    @property
    def interface(cls):
        return cls.__interface__(cls)

目标是让一些接口可用作静态和实例变量。但问题是这个接口应该在类构造函数上初始化。

0 个答案:

没有答案
相关问题