为什么@abstractmethod decorator只影响使用常规继承派生的子类?

2024-10-05 11:00:11 发布

您现在位置:Python中文网/ 问答频道 /正文

PEP 3119——引入抽象基类说明:

The @abstractmethod only affects subclasses derived using regular inheritance; "virtual subclasses" registered with the register() method are not affected.

我想知道为什么会这样

那么abc.ABCMeta.register()的用途是什么

注册子类比直接通过继承子类有什么好处

PEP 3119


Tags: theregisteronlywithvirtualinheritance基类pep

热门问题