大神看看这个错在哪?本人菜鸟
class Fib(object):
def __init__(self,num):
a,b,L=0,1,[]
for i in range(num):
L.append(a)
a,b=b,a+b
self.numbers=L
def __str__(self):
return str(self.numbers)
__repr__=__str__
def __call__(self,numb):
return Fib(numb)
f = Fib()
print f(10)
答案上用call代替了init的位置,不需要初始化了吗?