Skip to main content

Tiny dict-like structure with key slicing.

Project description

Python Slice Map

PyPi version PyPI 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:

  • 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


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.2.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slicemap-1.2.2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file slicemap-1.2.2.tar.gz.

File metadata

  • Download URL: slicemap-1.2.2.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for slicemap-1.2.2.tar.gz
Algorithm Hash digest
SHA256 e64fe286982b86534afd704666362ae2c0ac92266ab4defaaf48375a96b84183
MD5 a8a520d7e7bf04ff62d139f1fe9af46e
BLAKE2b-256 ced9d078433994a8814c1b140bccc5a6c65a6ae73f7a9af059b3466ed18638ab

See more details on using hashes here.

File details

Details for the file slicemap-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: slicemap-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for slicemap-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 06d01d850315d6aa7226155374e9c7d5e0ba0a465b48c4b648ef033e2ec223a7
MD5 18ac44a3341284f7899bb0dd21efe0a2
BLAKE2b-256 ca0f9dc7f3101ac1f0178ce257f7665cdab48fefc3f8c0b473c9fc57c080e3aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page