从Python
3.3开始,修复了一个错误,这意味着
property()装饰器现在应用于抽象方法时,可以正确地标识为抽象。
注:订单的问题,你必须使用
@property前
@abstractmethod
Python 3.3以上版本: (python
docs):
class C(ABC): @property @abstractmethod def my_abstract_property(self): ...
Python 2: (python
docs)
class C(ABC): @abstractproperty def my_abstract_property(self): ...



