利用类的self.class.mro() 方法调用 指定类的方法
class D():
def s(self):
print("d")
class A(D):
def __init__(self):
self.ss='aaaaaaaa'
def s(self):
print("A")
print(self.ss)
class B(A):
def __init__(self,bbbb):
self.b9=bbbb
def s(self,num):
print("B__",num)
class C(B):
def __init__(self):
self.ss='ccc'
super(B, self).__init__()
def s(self):
print("c")
print(self.ss)
super(B, self).s()
def ass(self,num):
# super(num, self).s()
print(self.__class__.mro())
for i in self.__class__.mro():
print(i.__name__)
if str(i.__name__)=='B':
print(i.__name__,"xxx")
i.s(self,'90909')
c=C()
c.s()
c.ass(A)
网友评论