hechengQAQ

导航

 

2023年3月1日

摘要: (1)第一种:直接创建 1 class Foo(object,metaclass=type): 2 def __init__(self): 3 print("我执行了") 4 super().__init__() 5 6 def test(self,x): 7 return x+1 (2)第二种:通 阅读全文
posted @ 2023-03-01 22:01 hechengQAQ 阅读(50) 评论(0) 推荐(0) 编辑
 
摘要: # __mro__ 查找继承顺序class A(object): passclass B(A): passclass C(object): passclass D(B, C): passprint(D.__mro__) # (<class '__main__.D'>, <class '__main_ 阅读全文
posted @ 2023-03-01 21:04 hechengQAQ 阅读(16) 评论(0) 推荐(0) 编辑