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.0.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.0.tar.gz.
File metadata
- Download URL: slicemap-1.2.0.tar.gz
- Upload date:
- Size: 42.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7930c56a57dbb882974b93649b9b056218580ca6e6096c25c48fba4fc8b8fb9e
|
|
| MD5 |
fa20a446f72050b0f653a0412ca4a14f
|
|
| BLAKE2b-256 |
595f56df18da64b8e97b415e7234488dfc063599fd735c144b5f24e8be11be16
|
File details
Details for the file slicemap-1.2.0-py3-none-any.whl.
File metadata
- Download URL: slicemap-1.2.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5d649a1c27184fe1f727539c00eeb496cea1f917e5260834ff64ea5caecfc65
|
|
| MD5 |
0f78e925c0177b889cb0d42444b17f14
|
|
| BLAKE2b-256 |
2401a645c082cbba26844d835376906eaeb7aefdb8d66389a1b4f065578372d4
|