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.2-py2.5.zip (86.6 kB view details)

Uploaded Source

generator_tools-0.3.2-py2.5.tgz (83.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

generator_tools-0.3.2.win32-py2.5.exe (145.9 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for generator_tools-0.3.2-py2.5.zip
Algorithm Hash digest
SHA256 2d5a3585c42efba227b6698116fe18a61abe0d5f85e22f62c0f65202921804aa
MD5 3aad97c83af22eb20ab7126eeab2c138
BLAKE2b-256 5203234a9d7260c017af590138b23d5c512c925ea6977388d5adcd746c5c6092

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for generator_tools-0.3.2-py2.5.tgz
Algorithm Hash digest
SHA256 eb301a64a51defda4cb72006c5fba3198eba70bb13e204e0d93dd5bcfc92858b
MD5 a5a7056684cc8438d344bbc8df1943f8
BLAKE2b-256 ac12fd5b1deb0986830a61985887662e6dbf57d640e633370ba43664f2130f72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for generator_tools-0.3.2.win32-py2.5.exe
Algorithm Hash digest
SHA256 41ef88d42431a25494318f19dc298b8841c3dc9bcc3b7630bbb69225596a6d1c
MD5 abcff161929b7a916c9d07293009b359
BLAKE2b-256 b1f03f745f8d6b03c086a3ab66f6b8bcb087214c402471e0e38d890dabda4ecf

See more details on using hashes here.

Supported by

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