继承 python 2.7 中的 aiml
Inheriting aiml in python 2.7
我正在尝试通过class方法继承aiml内核
import aiml
class Kern(aiml.Kernel):
def __init__(self):
super(Kern, self).__init__(self)
k = Kern()
aiml.Kernel 是一个 class 但当我尝试实例化 Kern 继承的超级 class 时我仍然收到以下错误
super(Kern, self).__init__(self)
TypeError: must be type, not classobj
请告诉我我犯了什么错误
super
不接受 self
作为参数。删除行中的两个 self
。以下将正常工作
super(Kern).__init__()
我正在尝试通过class方法继承aiml内核
import aiml
class Kern(aiml.Kernel):
def __init__(self):
super(Kern, self).__init__(self)
k = Kern()
aiml.Kernel 是一个 class 但当我尝试实例化 Kern 继承的超级 class 时我仍然收到以下错误
super(Kern, self).__init__(self)
TypeError: must be type, not classobj
请告诉我我犯了什么错误
super
不接受 self
作为参数。删除行中的两个 self
。以下将正常工作
super(Kern).__init__()