第17行用父类名称调用可以正常运行
第18行用super()调用报错:TypeError:super() argument 1 must be type, not classobj
有没有人帮忙解释一下为什么?
type —— 类,可选参数。
object-or-type —— 对象或类,一般是 self,可选参数。
参考这个
>>> help(super)
Help on class super in module builtins:
class super(object)
| super() -> same as super(__class__, <first argument>)
| super(type) -> unbound super object
| super(type, obj) -> bound super object; requires isinstance(obj, type)
| super(type, type2) -> bound super object; requires issubclass(type2, type)
| Typical use to call a cooperative superclass method:
| class C(B):
| def meth(self, arg):
| super().meth(arg)
| This works for class methods too:
| class C(B):
| @classmethod
| def cmeth(cls, arg):
| super().cmeth(arg)
不知道你这个问题是否已经解决, 如果还没有解决的话: