Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

slicemap

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slicemap

A tiny package containing a dict-like data structure with numeric slices as keys.

  • 1.1.2
  • PyPI
  • Socket score

Maintainers
1

Python Slice Map

PyPi version PyPI license Documentation Status Python 3.7 Python 3.8 Python 3.9 Python 3.10

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc