我有以下Python 2.7代码:
class Frame:
def __init__(self, image):
self.image = image
class Eye(Frame):
def __init__(self, image):
super(Eye, self).__init__()
self.some_other_defined_stuff()
Run Code Online (Sandbox Code Playgroud)
我正在尝试扩展该__init__()方法,以便当我实例化一个'Eye'时,除了Frame设置之外,还会做一堆其他的东西(self.some_other_defined_stuff()).Frame.__init__()需要先跑.
我收到以下错误:
super(Eye, self).__init__()
TypeError: must be type, not classobj
Run Code Online (Sandbox Code Playgroud)
其中我不明白其逻辑原因.有人可以解释一下吗?我习惯于在红宝石中输入'super'.