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.

Source Distributions

generator_tools-0.3.1-py2.5.zip (85.6 kB view details)

Uploaded Source

generator_tools-0.3.1-py2.5.tgz (82.9 kB view details)

Uploaded Source

Built Distribution

generator_tools-0.3.1.win32-py2.5.exe (144.9 kB view details)

Uploaded Source

File details

Details for the file generator_tools-0.3.1-py2.5.zip.

File metadata

File hashes

Hashes for generator_tools-0.3.1-py2.5.zip
Algorithm Hash digest
SHA256 bbf9e28e852621c7d057015a186394843d741017141c2c3be6c147ede50f7b53
MD5 1120f2f4828f9b346574f92614b72bbb
BLAKE2b-256 e54b5147a6b2595082744858272ee665b7b761dec892ba7247edcd12aaa82075

See more details on using hashes here.

File details

Details for the file generator_tools-0.3.1-py2.5.tgz.

File metadata

File hashes

Hashes for generator_tools-0.3.1-py2.5.tgz
Algorithm Hash digest
SHA256 898dcd783ff28a698f6d20d2d0844fb672f8bf9a1cbf69be9b6ab60af5922f8c
MD5 7e0badb1597ad3e3cb63cb6f820428e7
BLAKE2b-256 717384432326e7b511d374302dce332c04557f6fedaad717d69c389ed90d1bd9

See more details on using hashes here.

File details

Details for the file generator_tools-0.3.1.win32-py2.5.exe.

File metadata

File hashes

Hashes for generator_tools-0.3.1.win32-py2.5.exe
Algorithm Hash digest
SHA256 d14c6bb651b16a37087eced082f7ad3ae195869ed79088e8f737ea9a8c5ddb2f
MD5 c739bbeebae79d48ac452248dc5f54d5
BLAKE2b-256 cede38db85927c6da7f25f11d03121c967685781dc20733c00e02296111b6db0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page