用递归写的,为啥不对
class Fib(object):
def __init__(self, num):
self.num=num
if self.num==1:
return 0
if self.num==2:
return 1
else:
return Fib(self.num-2)+Fib(self.num-1)
def __str__(self):
return [Fib[v]for v in range(1,self.num+1)]
def __len__(self):
return self.num
f = Fib(10)
print f
print len(f)