A tiny package containing a dict-like data structure with numeric slices as keys.
Project description
Python Slice Map
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:
- Implemented entirely in Python
- Has only one dependency: sortedcontainers
- Is efficient, it has
O(log(n))
time complexity for insertion and query- Adding new slices might make old ones become redundant
n
correspondes to the maximal number of slices present in SliceMap at a time
- Makes life easier, see applications
Example
from 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.
Installation
Install easily with pip:
pip install slicemap
Links
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
slicemap-1.1.2.tar.gz
(8.9 kB
view details)
File details
Details for the file slicemap-1.1.2.tar.gz
.
File metadata
- Download URL: slicemap-1.1.2.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d18c0f958caa2b0f7b8c6ad455aeae6aa82b8a7b4badd322c09a2de78b23a5b6 |
|
MD5 | 7f15de9bd1046aa09b0a660d4d51ceb9 |
|
BLAKE2b-256 | 3e671dd27420d24076ad53deb93b087c58fce4b392b8481b214699638665a8de |