Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A lazy-loading, fancy-sliceable iterable.

Project description

a lazy-loading, fancy-slicable iterable

Think of it like a generator that is “reusable” and has a length.

build status


On any platform, use pip or conda.

pip install slicerator


conda install -c soft-matter slicerator


from slicerator import Slicerator

class MyLazyLoader:
    def __getitem__(self, i):
        # this method will be wrapped by Slicerator, so that it accepts slices,
        # lists of integers, or boolean masks. Code below will only be executed
        # when an integer is used.

        # load thing number i
        return thing

    def __len__(self):
        # do stuff
        return number_of_things

# Demo:
>>> a = MyLazyLoader()
>>> s1 = a[::2]  # no data is loaded yet
>>> s2 = s1[1:]  # no data is loaded yet
>>> some_data = s2[0]

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
slicerator-0.9.8.tar.gz (22.9 kB) Copy SHA256 hash SHA256 Source None Nov 20, 2016 (26.1 kB) Copy SHA256 hash SHA256 Source None Nov 20, 2016

Supported by

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