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.
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):
return thing
def __len__(self):
return number_of_things
>>> a = MyLazyLoader()
>>> s1 = a[::2]
>>> s2 = s1[1:]
>>> some_data = s2[0]