Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Proxy list to a list-returning function

Project description

PyPI Build Status

This small package provides a proxy list to a list-returning function:

>>> from lazylist import LazyList
>>> l = LazyList(lambda: x)
>>> x = [1, 2, 3]
>>> list(l)
[1, 2, 3]

More precisely, view function doesn’t have to return an exact list, but an any squence object e.g. str, tuple:

>>> x = "hello"
>>> list(l)
['h', 'e', 'l', 'l', 'o']

It satisfies protocol:

>>> from collections import Sequence
>>> isinstance(l, Sequence)
>>> l[-1]
>>> len(l)

However, it doesn’t satisfy protocol. In other words, it’s immutable:

>>> from collections import MutableSequence
>>> isinstance(l, MutableSequence)
>>> l[0] = 'H'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'LazyList' object does not support item assignment

Distributed under LGPLv3 or higher.


  • LazySet
  • LazyMap

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for lazylist, version 0.9.0
Filename, size File type Python version Upload date Hashes
Filename, size lazylist-0.9.0-py2.py3-none-any.whl (3.9 kB) File type Wheel Python version 3.5 Upload date Hashes View
Filename, size lazylist-0.9.0.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page