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

ordered-hash-set

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ordered-hash-set

Set that maintains insertion order

  • 0.1.3
  • PyPI
  • Socket score

Maintainers
1

================ Ordered Hash Set

.. image:: https://travis-ci.com/buyalsky/ordered-hash-set.svg?branch=master :target: https://travis-ci.com/buyalsky/ordered-hash-set

.. image:: https://img.shields.io/pypi/v/ordered-hash-set :alt: PyPI :target: https://pypi.org/project/ordered-hash-set/

ordered-hash-set is data structure that stores immutable unique elements. Unlike built-in set in python, it also keeps the insertion order.

Installation

Install via pip:

.. code-block:: console

pip install ordered-hash-set

Or install from source:

.. code-block:: console

python3 setup.py install

Basic Usage

.. code-block:: python

from ordered_hash_set import OrderedSet

s = OrderedSet()

s.add("London") s.add("Tokyo")

you can add multiple entries at once, like this:

s.update("Paris", "Istanbul") s.add("London") s.remove("Tokyo")

print(s) # prints: OrderedSet(London, Paris, Istanbul)

Thanks to the hashing. Time complexity of checking

if an element present in a collection is O(1).

Which is faster than regular list: O(n).

if "Paris" in s: print("Paris is in the set.")

to get the item by index:

assert s[2] == "Istanbul"

API Documentation

Please see API Reference Page <https://buyalsky.github.io/ordered-hash-set/en/master/rst/ordered_hash_set.html>_

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