def fibo(N): print 'starting' i = 0 a, b = 0, 1 while i < N: print 'looping' yield b a, b = b, a+b i += 1 print 'ending'