__metaclass__=type#super函数只在新式类中起作用
class bird:
def __init__(self):
self.hungry = True
def eat(self):
if self.hungry:
print 'Aaaah...!'
self.hungry=False
else:
print 'No, I`am full!'
class songbird(bird):
def __init__(self):
super(songbird,self).__init__()
self.sound='guaguagua!'
def sing(self):
print self.sound
songbird()的代码出现标题中的问题,可是我按照书上抄过来的代码,不知问题出在哪里,我的Python版本是2.7,谢谢