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.
Installation
On any platform, use pip or conda.
pip install slicerator
or
conda install -c soft-matter 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]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
slicerator-0.9.8.zip
(26.1 kB
view details)
slicerator-0.9.8.tar.gz
(22.9 kB
view details)
File details
Details for the file slicerator-0.9.8.zip
.
File metadata
- Download URL: slicerator-0.9.8.zip
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c48b9f5384f3d90e4c708b5b3bfb46c22f2c5b61efc8b23564b9dd85c9693ec |
|
MD5 | a2d151d3893d775e0f0f1e5c1ffe61a4 |
|
BLAKE2b-256 | 566df513f1655fa0f002ca975e6e0b57c0e109139e9c1c58a7a3b6ffa7311f84 |
File details
Details for the file slicerator-0.9.8.tar.gz
.
File metadata
- Download URL: slicerator-0.9.8.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b91dd76a415fd8872185cbd6fbf1922fe174359053d4694983fc719e4a0f5667 |
|
MD5 | 84a47c30fd06ba0f808f0d89e6a3e807 |
|
BLAKE2b-256 | 0b179d47a4b9250568b5b4c850332d4fc95f7f1d96918bbcb7855d3003b5e0c6 |