super()不能与staticmethod一起使用吗?
当我尝试像这样做时
class First(object):
@staticmethod
def getlist():
return ['first']
class Second(First):
@staticmethod
def getlist():
l = super(Second).getlist()
l.append('second')
return l
a = Second.getlist()
print a
我收到了以下错误信息
Traceback (most recent call last):
File "asdf.py", line 13, in <module>
a = Second.getlist()
File "asdf.py", line 9, in getlist
l = super(Second).getlist()
AttributeError: 'super' object has no attribute 'getlist'
如果我将静态方法更改为类方法,并将类实例传递给super(),那么事情就会很顺利。我在这里调用super(type)有问题吗,还是我漏掉了什么?