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 Distribution

regenerator-0.1.2.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

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

regenerator-0.1.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file regenerator-0.1.2.tar.gz.

File metadata

  • Download URL: regenerator-0.1.2.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for regenerator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 86879eb04e758a1a1f6251f3932536afd331d80639a0012cc785ef8973abcdfd
MD5 8444713ff42f37d35c6b8095c960c998
BLAKE2b-256 901ae35a28b4d7ce59f213898e6545ed70fa4f8a514ff01c0171b8c5d432f1dc

See more details on using hashes here.

File details

Details for the file regenerator-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: regenerator-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for regenerator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b80cb56299ed6f0e7b63417f0b7f966b50cada4187c128902f1e6cfbed2c55fe
MD5 da5fa34d64c1a9a02767c0270d177bae
BLAKE2b-256 f67592c1f2f355f66c7ab682387fe4f2535a46480f345c2c4518f52d00df844e

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