My Generator Paradox!

Felipe Almeida Lessa felipe.lessa at gmail.com
Fri Mar 17 01:29:41 CET 2006


Em Qui, 2006-03-16 às 16:17 -0800, vbgunz escreveu:
> print generatorFunction()           # <generator object at 0xb723022c>
> print generatorFunction().next()    # item1
> print generatorFunction().next()    # item1
> print generatorFunction().next()    # item1 

Each time you say "generatorFunction()", it gives you a new generator,
thus returning the first item again.




More information about the Python-list mailing list