更新时间:2023-01-16 09:10:53
动态地将抽象方法添加到类中,或尝试
创建方法或类后,立即修改其抽象状态,因此不支持
。 abstractmethod()仅影响使用常规继承派生的子类
。使用ABC的register()方法注册
的虚拟子类不受影响。
Dynamically adding abstract methods to a class, or attempting to modify the abstraction status of a method or class once it is created, are not supported. The abstractmethod() only affects subclasses derived using regular inheritance; "virtual subclasses" registered with the ABC’s register() method are not affected.
仅当以下情况调用元类时:类已定义。当抽象方法
将类标记为抽象时,状态以后将不会更改。
A metaclass is only called when a class is defined. When abstractmethod
has marked a class as abstract that status won't change later.