def Fib(): fn1, fn = 0, 1 while True: yield fn1 fn1, fn = fn, fn1 + fn f1 = Fib() f2 = Fib() for i in range( 10 ): print( next( f1 ), next( f2 ) ) # resume # Local Variables: # # tab-width: 4 # # compile-command: "python3.5 Fib2.py" # # End: #