import sys def fibonacci(): x = 0 y = 1 while 1: yield y x, y = y, x + y f = fibonacci() for i in range(10): print f.next()