super函数的作用

super函数的作用
super().__init__()
当子类重写父类的方法时,会覆盖父类方法,super此举是保留父类

如果属性名跟方法名相同,属性会覆盖方法

方法必须要有实例才能被调用,这叫做绑定

class Parent(object):
    def hello(self, name):
        print "开始"
        print u"%s 正在调用父类的方法..." % name


class Child(Parent):
    def hello(self, name):
        super(Child, self).hello(name)
        print "%s 正在调用子类的方法..." % name
原文地址:https://www.cnblogs.com/themost/p/7050207.html