Skip to main content

Dead simple & fast ordered set using python's 3.7+ dict.

Project description

A dead simple set that preserves insertion order, internally using the python’s 3.7 dict, which preserves order.

pip install ordered-set-37

This class subclasses and implements all the methods of MutableSet.

from ordered_set_37 import OrderedSet
x = OrderedSet([1, 2, -1, "bar"])
x.add(0)
assert list(x) == [1, 2, -1, "bar", 0]

This library uses the typing system, so feel free to do:

x: OrderedSet[str] = OrderedSet(("foo", "bar"))
x.add(1)  # type checkers won't like this as it is not a string

As an extra, you can access a value by index (although the speed is at worst O(n)):

x = OrderedSet(["foo", "bar", "baz"])
assert x[1] == "bar"

For obvious reasons, this library is only Python 3.7+ compatible.

Feel free to contribute, fork, etc.

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

Ordered-set-37-1.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

Ordered_set_37-1.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file Ordered-set-37-1.1.tar.gz.

File metadata

  • Download URL: Ordered-set-37-1.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for Ordered-set-37-1.1.tar.gz
Algorithm Hash digest
SHA256 cb63384712f35dfbe4adb3139590e2957ee25fdb848e3459e98070b32d72f993
MD5 af0f1a1e043be28a26f70510edc956e1
BLAKE2b-256 870d8f4213996d8049839aea7971266c20f6c6cd3b408b03ff7d46ad5b8e1fbc

See more details on using hashes here.

File details

Details for the file Ordered_set_37-1.1-py3-none-any.whl.

File metadata

  • Download URL: Ordered_set_37-1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for Ordered_set_37-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b50100801f4f008c4a783df5f49041e1b3ae461a7f82f1b7aff558a5391e7b1
MD5 b91a4e5001bb549ca8f4e84e32c8d5aa
BLAKE2b-256 c041253ec27922b34539adea1361ce620cdf15dafb672331874f8722f1cff1cf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page