Skip to main content

Treat an iterator as a list

Project description


Lazily evaluated lists in Python

An iterlist.IterList accepts a single iterable as its only constructor argument.

The iterlist.IterList behaves as a normal list, and will only evaluate the iterable as needed to satisfy requests for element.

If there is a request for index [5], then elements 0 - 5 will be evaluated if they have not been yet. Certain operations like len and negative indexing will force the list to be evaluated. This decision was made to make the iterlist outwardly appear as much like a normal list as possible.

Infinite Iterators

This implementation does not make any attempt to protect you from running out of memory attempting to construct a list from an infinite iterator. A future version may implement InfiniteIterList, which will not have support for any operation which would require consuming the entire iterable.


BSD 2-clause (inherited from lazylist)

Prior Work

Apparently this is not a new idea...

Forked from: (2014/10) (2014/07) (2008/08) (unknown)

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

iterlist-0.4.tar.gz (10.1 kB view hashes)

Uploaded source

Built Distribution

iterlist-0.4-py3-none-any.whl (6.0 kB view hashes)

Uploaded py3

Supported by

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