Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to reinicializate a generator.

Hi,

I would like to know how to reinicializate a generator. I mean, if I for example have:

generador = (n for n in range(1,10000) if (is_prime(n) & is_prime(n+2)))

And then i run generador.next() for example twice. How can i reainicializate this generator so that when i run generador.next() again i get the first element?

If it is possible, i would thank you a lot if you can link the documentation file with the info, because i have searching for it so long and I didn't find anything.

Thanks ;)

P.D. Maybe my english is not good enought and i misspelled some words. Sorry about that.

How to reinicializate a generator.

Hi,

I would like to know how to reinicializate reinicializate/reset a generator. I mean, if I for example have:

generador = (n for n in range(1,10000) if (is_prime(n) & is_prime(n+2)))

And then i run generador.next() for example twice. How can i reainicializate reinicializate/rest this generator so that when i run generador.next() again i get the first element?

If it is possible, i would thank you a lot if you can link the documentation file with the info, because i have searching for it so long and I didn't find anything.

Thanks ;)

P.D. Maybe my english is not good enought and i misspelled some words. Sorry about that.

click to hide/show revision 3
corrected minor misspellings

How to reinicializate reinitialize a generator.

Hi,

I would like to know how to reinicializate/reset reinitialize/reset a generator. I mean, if I for example have:

generador generator = (n for n in range(1,10000) if (is_prime(n) & is_prime(n+2)))

And then i run generador.next() generator.next() for example twice. How can i reinicializate/rest reinitialize/rest this generator so that when i run generador.next() generator.next() again i get the first element?

If it is possible, i would thank you a lot if you can link the documentation file with the info, because i have searching for it so long and I didn't find anything.

Thanks ;)

P.D. Maybe my english is not good enought and i misspelled some words. Sorry about that.

click to hide/show revision 4
No.4 Revision

updated 2011-01-03 14:23:27 -0500

kcrisman gravatar image

How to reinitialize a generator.

Hi,

I would like to know how to reinitialize/reset a generator. I mean, if I for example have:

sage: generator = (n for n in range(1,10000) if (is_prime(n) & is_prime(n+2))) 

is_prime(n+2)))

And then i run generator.next() generator.next() for example twice. How can i reinitialize/rest this generator so that when i run generator.next() generator.next() again i get the first element?

If it is possible, i would thank you a lot if you can link the documentation file with the info, because i have searching for it so long and I didn't find anything.

Thanks ;)

P.D. Maybe my english is not good enought and i misspelled some words. Sorry about that.