基于这个问题:Force child class to overrideparent'smethods,我的需要是在类中设置一个必须由子类覆盖的属性:
class Parent(ABC): property = None # this one must be defined # this should fail class Child(Parent): pass
谢谢!
python oop
oop ×1
python ×1