def fibonacci while True yield fibonacci for in xrange 999 next next 1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
def fibonacci():
a, b = 0, 1
while True:
yield a
a, b = b, a + b
x = fibonacci()
for i in xrange(1, 999):
x.next()
x.next() # 1000 fib number