Significant changes in major and minor releases of this library:
- Major refactor
- Added a StableSet implementation, as a base class for OrderedSet.
- Added Many functions to OrderedSet, to be more complete and more compatible with other implementations.
- popitem(last: bool = True), similar to
dict.popitem
(note minor incompatibility with another implementation (orderedset
) that have thelast
keyword in thepop
function) - move_to_end(key), similar to
dict.move_to_end
- le, lt, ge, gt - to improve subset/superset testing
- popitem(last: bool = True), similar to
- Minimum Python version is 3.8 (because reversed)
- Fix: OrderedSet.update now raised a TypeError instead of a ValueError when the type of the input is incorrect
- Added many new tests, and all the tests from 2 other implementations.
- Packaged using flit. Wheels now exist, and setuptools is no longer required.
- This package now has a typical package structure, instead of being a single module. The code is in
ordered_set/__init__.py
instead ofordered_set.py
. - There is an
ordered_set/py.typed
so that type checkers know about the types. - Use the type aliases
SetLike[T]
andOrderedSetInitializer[T]
to simplify some types. - Updated the way overloaded type signatures are written to what MyPy currently expects.
- Minimum Python version is 3.7.
- Added type signatures inline to the code, instead of using type stubs.
- Dropped Python 2 support. The minimum supported Python version is 3.5.
__getitem__
accepts NumPy arrays of indices, and returns a list of elements with those indices.- Updated in-place operations that took O(N^2) time, such as .difference_update(), to take O(N) time.
- Clarified whether various methods mutate or copy the OrderedSet.
- Added
OrderedSet.get_loc
andOrderedSet.get_indexer
as aliases forOrderedSet.index
, for interoperability withpandas.Index
. - Added type stubs in a .pyi file.
- Implemented the abstract base classes
collections.MutableSet
andcollections.Sequence
. - Changed the behavior of some methods to follow the MutableSet API.
- Indexing an OrderedSet with
[:]
returns a copy, not the same object.
- Tuples are allowable values in the set, and are not treated as "fancy indexing".
- Added
update
andpop
methods.
- Added
discard
andclear
methods.
- Added support for pickling.
- First Python 3 support.
- Added tests.
- Removed a broken implementation of
discard
.
- First release.