【发布时间】:2011-12-10 00:47:12
【问题描述】:
我想从继承的类中调用父级的 call 方法
代码如下所示
#!/usr/bin/env python
class Parent(object):
def __call__(self, name):
print "hello world, ", name
class Person(Parent):
def __call__(self, someinfo):
super(Parent, self).__call__(someinfo)
p = Person()
p("info")
我明白了,
File "./test.py", line 12, in __call__
super(Parent, self).__call__(someinfo)
AttributeError: 'super' object has no attribute '__call__'
我不知道为什么,有人可以帮我解决这个问题吗?
【问题讨论】:
标签: python inheritance methods superclass