I have googled around for some time, but what I got is all about instance property rather than class property. For example, this is the most-voted answer for question from stackoverflow
class C(ABC):
@property
@abstractmethod
def my_abstract_property(self):
return 'someValue'
class D(C)
def my_abstract_property(self):
return 'aValue'
class E(c)
# I expect the subclass should have this assignment,
# but how to enforce this?
my_abstract_property = 'aValue'
However, that is the instance property case, not my class property case. In other words, calling
D.my_abstract_property
will return something like <unbound method D.my_abstract_property>
. Returning 'aValue' is what I expected, like class E.