def fib(): a,b = 0.1 while True: yield b a,b = b,a+b fib = fib() print [fib.next() for i in range(10)]