Skip to main content

generator_tools enable copying and pickling generators

Project description

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<start+10:
yield i
i+=1

>>> 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for generator_tools, version 0.3.6
Filename, size File type Python version Upload date Hashes
Filename, size generator_tools-0.3.6.tar.gz (87.9 kB) File type Source Python version None Upload date Hashes View
Filename, size generator_tools-0.3.6.win32-py2.5.exe (161.3 kB) File type Windows Installer Python version 2.5 Upload date Hashes View
Filename, size generator_tools-0.3.6.win32-py2.6.exe (161.3 kB) File type Windows Installer Python version 2.6 Upload date Hashes View
Filename, size generator_tools-0.3.6.zip (90.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page