今天遇到这个错误:
Traceback (most recent call last):
File "t2.py", line 14, in <module>
print Derived().meth()
File "t2.py", line 10, in meth
super(Derived,self).meth()
TypeError: must be type, not classobj
试验代码如下:
- class Base():
- def meth(self):
- print "i'm base"
- class Derived(Base):
- def meth(self):
- super(Derived,self).meth()
- print "this is derived"
- print Derived().meth()
- class Base(object):
- def meth(self):
- print "i'm base"