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.
Please see the documentation for examples and an API reference.
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slicerator-1.0.0rc1.tar.gz.
File metadata
- Download URL: slicerator-1.0.0rc1.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf67f64271884ad34be3166243786ec4b5f1ba96497c620f9239a74882c291ea
|
|
| MD5 |
184b0eb9db023b0329cc4159a6d09e13
|
|
| BLAKE2b-256 |
c4cc3af83c5770428d9b6f13476a06cbb4ce2a4c79cb8337c7e42cbd4307336f
|
File details
Details for the file slicerator-1.0.0rc1-py3-none-any.whl.
File metadata
- Download URL: slicerator-1.0.0rc1-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46192758c864e08ee6c7efeaf00b58fc35488b3a97c7b7ffa2bcc6b0aee39c95
|
|
| MD5 |
d1d801b3a3388c2fe836af6ec0c550dd
|
|
| BLAKE2b-256 |
c3b9eb9998b7553bf93f56683f8c4a89d28c56af01640957b54f97047a353ce2
|