Skip to main content

Lazily Resolving Sequence

Project description

Latest version

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.


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]

Or use the Genseq class on any iterable:

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

Happy indexing!

Project details

Release history Release notifications | RSS feed

This version


Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page