skip to navigation
skip to content

Not Logged In

generator_tools 0.3.6

generator_tools enable copying and pickling generators

The generator tools package enables copying and pickling running generators in
CPython ( you don't need Stackless Python ).

Usage
-----

from generator_tools.copygenerators import*
from generator_tools.picklegenerators import*

def f(start):
        i = start
        while i>> f_gen = f(5)
>>> f_gen.next()   # or next(f_gen) in Python 3.0
5
>>> f_gen.next()
6
>>> g_gen = copy_generator(f_gen)
>>> h_gen = copy_generator(f_gen)
>>> g_gen.next()
7
>>> h_gen.next()
7
>>> pickler = GeneratorPickler("test.pkl")
>>> pickler.pickle_generator(g_gen)
>>> k_gen = pickler.unpickle_generator()
>>> list(g_gen) == list(k_gen)
True
 
File Type Py Version Uploaded on Size
generator_tools-0.3.6.tar.gz (md5) Source 2009-02-24 85KB
generator_tools-0.3.6.win32-py2.5.exe (md5) MS Windows installer 2.5 2009-02-24 157KB
generator_tools-0.3.6.win32-py2.6.exe (md5) MS Windows installer 2.6 2009-02-24 157KB
generator_tools-0.3.6.zip (md5) Source 2009-02-24 88KB
  • Downloads (All Versions):
  • 92 downloads in the last day
  • 305 downloads in the last week
  • 2479 downloads in the last month