Skip to main content

Slicerator

a lazy-loading, fancy-slicable iterable

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

Please see the documentation for examples and an API reference.

build status Documentation Status

Installation

On any platform, use pip or conda.

pip install slicerator

or

conda install -c conda-forge slicerator

Example

from slicerator import Slicerator

@Slicerator.from_class
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]

Release files for slicerator 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slicerator 1.1.0
File Size Uploaded
slicerator-1.1.0.tar.gz 38.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for slicerator 1.1.0
File Interpreter ABI Platform
slicerator-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 48.6 kB

Release files / slicerator-1.1.0.tar.gz

Download URL slicerator-1.1.0.tar.gz
Size 38.3 kB
Tags Source
SHA-256 checksum
How to use checksums
44010a7f5cd87680c07213b5cabe81d1fb71252962943e5373ee7d14605d6046
BLAKE2b-256 checksum
How to use checksums
0c52f38586b82b2935f8b59a09b0a79c545a22ed062e728c9418bafeb51f61e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / slicerator-1.1.0-py3-none-any.whl

Download URL slicerator-1.1.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
167668d48c6d3a5ba0bd3d54b2688e81ee267dc20aef299e547d711e6f3c441a
BLAKE2b-256 checksum
How to use checksums
e8aefa6cd331b364ad2bbc31652d025f5747d89cbb75576733dfdf8efe3e4d62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

0.9.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page