python中super()出现的TypeError: must be type, not classobj

来源:互联网 发布:sql insert 单引号 编辑:程序博客网 时间:2024/06/05 11:51

python中super()只能应用于新式类,而不能应用于经典类.否则会出现报错:TypeError: must be type, not classobj 

Python 2.x中默认都是经典类,只有显式继承了object才是新式类

Python 3.x中默认都是新式类,不必显式的继承object

0 0