Skip to main content

An OrderedSet is a custom MutableSet that remembers its order, so that every entry has an index that can be looked up.

Based on a recipe originally posted to ActiveState Recipes by Raymond Hettiger, and released under the MIT license:

http://code.activestate.com/recipes/576694-orderedset/

Rob Speer’s changes are as follows:

  • changed the content from a doubly-linked list to a regular Python list. Seriously, who wants O(1) deletes but O(N) lookups by index?

  • add() returns the index of the added item

  • index() just returns the index of an item

  • added a __getstate__ and __setstate__ so it can be pickled

  • added __getitem__

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-1.0.1.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file ordered-set-1.0.1.tar.gz.

File metadata

  • Download URL: ordered-set-1.0.1.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ordered-set-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e946bbb5a689eb5e6f5f1515964e19e5376fde57747767204eb695d9a38ac3c6
MD5 478d253ed92ab13de7bcbdc1b05a09b9
BLAKE2b-256 84056b87786d97a542d8029a1e1ef47ba9eee97de5b42c41f601b25fecb24648

See more details on using hashes here.

Release history Release notifications | RSS feed

4.1.0

2 files

4.0.2

1 file

4.0.1

1 file

3.1.1

1 file

3.1

2 files

3.0.2

1 file

3.0.1

1 file

3.0.0

1 file

2.0.2

1 file

2.0.1

1 file

2.0.0

1 file

1.4.0

1 file

1.3.1

1 file

1.3

1 file

1.2

1 file

1.1

1 file

This release

1.0.1 This release

1 file

1.0

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page