采用新式类,要求最顶层的父类一定要继承于object
,这样就可以利用super()函数来调用父类的init()等函数,
每个父类都执行且执行一次,并不会出现重复调用的情况。而且在子类的实现中,不用到处写出所有的父类名字,符合DRY原则。
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/
https://www.zhihu.com/question/20040039
https://taizilongxu.gitbooks.io/stackoverflow-about-python/content/19/README.html
http://www.jackyshen.com/2015/08/19/multi-inheritance-with-super-in-Python/