cloning generator iterators
Michael
ms at cerenity.org
Sun Aug 20 18:20:08 EDT 2006
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: What is the best way to implement this clone operation?
However you should be able to do what you want using the small extension
"statesaver" which you can grab from
* http://www.gosubway.org/install/statesaver.c
The statesaver allows you to clone generators in the way that you want.
FWIW, I can see lots of situations where this would be useful - mainly in
the area of dealing with search spaces (After all, this effectively allows
you to fork the generator).
Michael.
--
http://kamaelia.sourceforge.net/Home - Concurrency, Networking, Simplicity
More information about the Python-list
mailing list