forked from rspeer/ordered-set
-
Notifications
You must be signed in to change notification settings - Fork 0
A MutableSet that remembers its order, so that every entry has an index
License
leo-labs/ordered-set
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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__ Tested on Python 2.6, 2.7, 3.3, 3.4, 3.5, PyPy, and PyPy3.
About
A MutableSet that remembers its order, so that every entry has an index
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Python 100.0%