一。面向对象super的作用:
class parent(object):
    def __init__(self):
        self.test()

    def test(self):
        print('parent---')

class BaseHandler(object):
    def test(self):
        print('BASEhandler')
        super(BaseHandler,self).test()  #不影响后面函数运行,即运行自身的test函数,也运行别人的。如果不加super的话运行自身后停止运行后面相同的函数名(如果父类和子类都有相同的方法,先运行父类的再运行子类的)

class task(BaseHandler,parent):
    pass
obj=task()
View Code

相关文章: