def even_numbers(): i = 0 while True: yield i*2 i += 1 for i in even_numbers(): print i