+
Skip to content

szmikler/slicemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Tiny dict-like structure with key slicing.

Topics

Resources

License

Stars

Watchers

Forks

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载