Python 2.3
在以下脚本中调用基类函数时遇到问题。看完这篇文章后:
我已经生成了一小段代码:
class Base(object):
def func(self):
print "Base.func"
class Derived(Base):
def func(self):
super(Base, self).func()
print "Derived.func"
Derived().func()
上面的代码会产生这个错误:
Traceback (most recent call last):
File "py.py", line 13, in ?
Derived().func()
File "py.py", line 10, in func
super(Base, self).func()
AttributeError: 'super' object has no attribute 'func'
我错过了什么?