show me the code
def fab(max):
n, a, b = 0, 0, 1
while n < max:
yield b
# print b
a, b = b, a + b
n = n + 1
...
>>> for n in fab(5):
... print n
...
1
1
2
3
5
yield一般用在用循环功能的函数内,用在把循环里的数据提取出来,有点像OC的block