Kay Schluehr wrote: > Originally I came up with the idea of a pure Python implementation for > copyable generators as an ActiveState Python Cookbook recipe. Too bad, > it was badly broken as Klaus Müller from the SimPy project pointed > out. Two weeks and lots of tests later I got finally a running version > that works not only in the very most simple use cases. As the code > size increased it turned out to not really fit anymore into the > "recipe" category and I created a package called "generator_tools". > > generator_tools-0.1 is available for both Python 2.5 and Python 3.0 > (!) [snip] >>>> pickler = GeneratorPickler("test.pkl") >>>> pickler.pickle_generator(g_gen) >>>> k_gen = pickler.unpickle_generator() >>>> list(g_gen) == list(k_gen) > True
This seems like an odd syntax for pickling. Does the package support the normal pickle machinery? That is, does it register the appropriate methods with the copy_reg module? STeVe -- http://mail.python.org/mailman/listinfo/python-list