Skip to main content

Package Description

CI Documentation Status

A Python library to provide "chains", which are Lisp-like singly linked lists that support the lazy expansion of iterators. For example, we can construct a Chain of three characters from the iterable "abc" and it initially starts as unexpanded, shown by the three dots:

>>> from lazychains import lazychain
>>> c = lazychain( "abc")
>>> c
chain([...])

We can force the expansion of c by performing (say) a lookup or by forcing the whole chain of items by calling expand:

>>> c[1]                   # Force the expansion of the next 2 elements.
True
>>> c
chain(['a','b',...])
>>> c.expand()             # Force the expansion of the whole chain.
chain(['a','b','c'])

Chain are typically a lot less efficient than using ordinary arrays. So, almost all the time you should carry on using ordinary arrays and/or tuples. But Chains have a couple of special features that makes them the perfect choice for some problems.

  • Chains are immutable and hence can safely share their trailing segments.
  • Chains can make it easy to work with extremely large (or infinite) sequences.

Expanded or Unexpanded

When you construct a chain from an iterator, you can choose whether or not it should be immediately expanded by calling chain rather than lazychain. The difference between the two is pictured below. First we can see what happens in the example given above where we create the chain using lazychain on "abc".

chain

By contrast, we would immediately go to a fully expanded chain if we were to simply apply chain:

>>> from lazychains import chain
>>> c = chain( "abc" )
>>> c
chain(['a','b','c'])
>>> 

lazychain

Metadata

Release files for lazychains 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lazychains 0.3.1
File Size Uploaded Provenance Actions
lazychains-0.3.1.tar.gz 81.5 kB Without provenance Details for lazychains-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lazychains 0.3.1
File Interpreter ABI Platform Actions
lazychains-0.3.1-py3-none-any.whl Python 3 none any Details for lazychains-0.3.1-py3-none-any.whl

Total release size: 100.1 kB

Release files / lazychains-0.3.1.tar.gz

Download URL lazychains-0.3.1.tar.gz
Size 81.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b20a097bcba7ffb8852802fc18a49fa8ddb1af0236729863c9dd3b615095b078
BLAKE2b-256 checksum
How to use checksums
3f5965beee97432892d6ba917a1fcb5f6a78768286314318aba212a3ac2471b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / lazychains-0.3.1-py3-none-any.whl

Download URL lazychains-0.3.1-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38450b85c8e81cb30fc4c6c4b0836a5d1683ea777738fa9f04c20e10a92108e8
BLAKE2b-256 checksum
How to use checksums
87541f86564e669bfa598a043a9f4d24db098e840481597ad923da1593f9d82d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for lazychains 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page