A Fork from LuminosoInsight/ordered-set, according to #Pull requests 22 .
Project description
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:
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__
__getitem__ and index() can be passed lists or arrays, looking up all the elements in them to perform NumPy-like “fancy indexing”
minghu6’s changes are as follow:
restrict the OrderedSet operation object: only themselves. Because OrderededSet’s element consists of its index and value, Python set’s element only consists of its value, however. I have written a new class OrderedSetAdapter to adapt Python set.
writtern a new class OrderedSetAdapter
rewrittern some contradictory method from collections.MutableSet
Tested on Python 2.7, 3.3, 3.4, 3.5, 3.6, PyPy, and PyPy3.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for ordered-set-minghu6-3.0.1rc1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 996a4885e6c02ab19b0722e8ff4f8f792c918435efd0c0234d0ad4b5d5f5fb9a |
|
MD5 | 3c0d173e127619ebe34fcff9eefe1bd0 |
|
BLAKE2b-256 | 3506d9bc72168d6778bbda7aabd880cce6bc5c327df33796e510444a5ac5aee1 |
Hashes for ordered_set_minghu6-3.0.1rc1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e239afa3cea1d463d60f4e9c2412981371d468b5571fef23badd058516180510 |
|
MD5 | 73c6d7bd89811ed57959d258ebb23fad |
|
BLAKE2b-256 | c9e5ce86ce9ddffa490fba6ee9f4305a6f4ae496dbf23dc278a1e27d7b16ffe5 |
Hashes for ordered_set_minghu6-3.0.1rc1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec3e4df72968dde9a790b4346e35f35f67e51cd699bc939fcfddaa796970d036 |
|
MD5 | 7344c62a2e911ccef022b61dd3d51448 |
|
BLAKE2b-256 | ddf236a233c1a8ef1abe513c69a5e66c35bce57250a3a52df1e18963a72411a0 |