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.0.tar.gz (42.1 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.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

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

Hashes for slicemap-1.2.0.tar.gz
Algorithm Hash digest
SHA256 7930c56a57dbb882974b93649b9b056218580ca6e6096c25c48fba4fc8b8fb9e
MD5 fa20a446f72050b0f653a0412ca4a14f
BLAKE2b-256 595f56df18da64b8e97b415e7234488dfc063599fd735c144b5f24e8be11be16

See more details on using hashes here.

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

Hashes for slicemap-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5d649a1c27184fe1f727539c00eeb496cea1f917e5260834ff64ea5caecfc65
MD5 0f78e925c0177b889cb0d42444b17f14
BLAKE2b-256 2401a645c082cbba26844d835376906eaeb7aefdb8d66389a1b4f065578372d4

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