Skip to main content

Lazily Resolving Sequence

Project description

Latest version https://travis-ci.org/ryanhiebert/genseq.svg?branch=master

Genseq is sequence data structure that lazily consumes any iterable, including a generator, so that you can enjoy the benefits of both delayed evaluation, and the slicing and random access of lists.

The Genseq class implements the collections Sequence ABC, so the standard methods of using an immutable sequence are all available.

Usage

Install using Pip:

pip install genseq

Then wrap your generator with genseq:

>>> from genseq import genseq
>>> @genseq
... def myiter(stop):
...     for i in range(stop):
...         yield i
...
>>> myiter(5)[2]
2
>>>

Or use the Genseq class on any iterable:

>>> from genseq import Genseq
>>> Genseq(range(5))[3]
3
>>>

Happy indexing!

Project details


Release history Release notifications

This version

1.0

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page