A tiny package containing a dict-like data structure with numeric slices as keys.
MIT License
Slicemap is a MIT licensed library introducing a useful, dictionary-like data structure, similar to normal Python dict, but instead of setting values key by key, you set entire slices.
Features:
O(log(n))
time complexity for insertion and query
n
correspondes to the maximal number of slices present in SliceMap at a timefrom slicemap import SliceMap
sm = SliceMap()
sm[-3:3] = 0.1
sm[6.5:] = "Hello, SliceMap"
print(sm[0])
print(sm[10])
0.1
'Hello, SliceMap'
See more examples in Quick Start.
Install easily with pip:
pip install slicemap