def fibGen(n): a, b = 0, 1 while n>0: yield a a, b, n = b, a+b, n-1