Bernhard Mulder wrote:
> [ attempt to clone/fork a generator ]
You can do this, but you can't pickle the results. (If you want pickling,
use Stackless - I've not tried pickling generators in stackless because I
don't use stackless, but it looks pretty clear you can pickle them there)
> Question
Oops. Got the indentation wrong. Here is the corrected version:
def generator(self):
while True:
while True:
if (yield 1):
if (yield 1):
break
self.n = 2
while (yield self.n):
I have something like the following (using Python 2.5 syntax):
class adapt(object):
def __init__(self):
self.iterator = self.generator()
self.n = 0
def generator(self):
while True:
while True:
if (yield 1):
if (yield 1