Skip to main content

Simple class for reusable generators.

Project description

regenerator

Create a reusable generator.

Depending on your process, it is likely faster to simply run the code to create your generator to create a "copy". However, if all you have is the generator itself, the regenerator package can create a copy. For large iterables, it is expected that copying the generator will offer speed-up. Furthermore, generators can be copied multiple times. The use-case therefore is in operations that need to be repeated, but creating a list out of the generator is too expensive.

Example use

# Import
from regenerator import Regenerator

# Create a generator
generator = (x for x in range(10))

# Create a Regenerator from generator
regenerator = Regenerator(generator)

# Run through generator once
for x in regenerator:
    print(x)

# Run through the generator again
for x in regenerator:
    print(x)

...

Installation

This package is available through pip,

pip install regenerator

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

regenerator-0.1.1.post0.dev3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file regenerator-0.1.1.post0.dev3-py3-none-any.whl.

File metadata

File hashes

Hashes for regenerator-0.1.1.post0.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 bfb4cc1145f9fb15ff97991772c4fb18ad92e9a701442dc6e7a8a57dc6eca40a
MD5 ac82767a77b7de6ba4ca44256616a9de
BLAKE2b-256 5be436a2fca4974c502f066c1c9a0e1d036a9230f22f8f76cef71f365d608854

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