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

prioheap

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prioheap

Priority queue with a sane API

  • 0.0.2
  • PyPI
  • Socket score

Maintainers
1

PrioHeap

test badge

A priority queue from the textbooks. Python implementation is surprinsigly not modern.

Installation

pip3 install prioheap

Usage

The API is dead simple:

import prioheap

prio = prioheap.PrioHeap()
prio.add(0) # add element
prio.add(3)
prio.peak()  # return highest element, e.g. 3
prio.add(1)
prio.pop()  # remove and return highest element, 3.

len(prio), bool(prio)  # those are supported
iter(prio), list(prio)  # iterate elements in decreasing order

Test

To run the unit tests from the root of this repository:

python3 -m tests

License

License is Unlincense, so public domain.

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