Tiny dict-like structure with key slicing.
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
ncorrespondes 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.2.1.tar.gz
(42.1 kB
view details)
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 slicemap-1.2.1.tar.gz.
File metadata
- Download URL: slicemap-1.2.1.tar.gz
- Upload date:
- Size: 42.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93afa6c4bcd3dd95e925e89c18acbe9c8b3afb57bcec693f2f03c4ffc84c8dd2
|
|
| MD5 |
e2f7626e9ee6cc828c637929d312f8e4
|
|
| BLAKE2b-256 |
1f717daf0cab76a081cd231337aa18add9a99325fe29c4508ead129398ba0d55
|
File details
Details for the file slicemap-1.2.1-py3-none-any.whl.
File metadata
- Download URL: slicemap-1.2.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0772d1b2c16811db0026ccc89695c93e0886b9ea7f91e8f3ed316a5ccbd6c74a
|
|
| MD5 |
8cb4e33251c08f2d35ac1a0b8f879463
|
|
| BLAKE2b-256 |
c4afbef6fe7080a22de49a76574a1d82ae8c4cb9fa1a62062debf4d11581272f
|