|
1 | 1 | Sorted Containers Release History
|
2 | 2 | =================================
|
3 | 3 |
|
| 4 | +.. currentmodule:: sortedcontainers |
| 5 | + |
4 | 6 | 2.0.0 (2018-05-04)
|
5 | 7 | ------------------
|
6 | 8 |
|
7 |
| -Big update to the source base. Now adopting Python 3 semantics. Still |
8 |
| -supporting Python 2. But primary development is now on Python 3.6. |
| 9 | +Version 2 represents a significant update to the source base. The code has been |
| 10 | +refactored and modernized to embrace Python 3 semantics while also using |
| 11 | +`autodoc` in Sphinx for more maintainable documentation. The core design and |
| 12 | +algorithms are all the same. Sorted Containers still supports and is tested on |
| 13 | +Python 2 but primary development is now on Python 3.6. |
| 14 | + |
| 15 | +Version 2 is developed on the `master` branch in the source repository and |
| 16 | +Version 1 of Sorted Containers will be maintained on branch `v1`. |
| 17 | + |
| 18 | +Version 3 of Sorted Containers will be released sometime after January 1, 2020 |
| 19 | +and will drop support for Python 2. |
| 20 | + |
| 21 | +At a high-level, changes can be categorized in three ways: |
| 22 | + |
| 23 | +1. :class:`SortedList` methods `__setitem__`, `append`, `extend`, and `insert` |
| 24 | + all now raise :exc:`NotImplementedError`. Use `add` or `update` |
| 25 | + instead. Though it's possible to implement these methods, they were |
| 26 | + confusing, inefficient and wrongly used by some users. Sorted list |
| 27 | + implementations that need the functionality are encouraged to do so through |
| 28 | + subclassing. Branch `v1` contains a reference implementation. |
| 29 | +2. :class:`SortedDict` now uses Python 3 semantics for dict views. The |
| 30 | + `iterkeys`, `iteritems`, `itervalues`, `viewkeys`, `viewitems`, and |
| 31 | + `viewvalues` methods have all been removed. Use the `keys`, `items`, or |
| 32 | + `values` methods which now return sorted dict views. :class:`SortedKeysView` |
| 33 | + has also replaced `SortedDict.iloc` as a better interface for indexing. |
| 34 | +3. Method parameter names have changed to be more consistent with Python's |
| 35 | + built-in data types: `val` has changed to `value`, `idx` has changed to |
| 36 | + `index`, and `that` has changed to `other`. |
| 37 | + |
| 38 | +**API Changes** |
9 | 39 |
|
10 |
| -* SortedListWithKey is deprecated. Use SortedKeyList instead. |
| 40 | +* :class:`SortedListWithKey` is deprecated. Use :class:`SortedKeyList` instead. |
| 41 | + The name `SortedListWithKey` remains as an alias for `SortedKeyList`. The |
| 42 | + alias will be removed in Version 3. |
| 43 | +* `sortedcontainers.sortedlist.LOAD` has moved to |
| 44 | + `SortedList.DEFAULT_LOAD_FACTOR` so that derived classes can customize the |
| 45 | + value. |
| 46 | +* `SortedList._half` and `SortedList._dual` have been removed. Use |
| 47 | + `SortedList._load` instead. |
| 48 | +* :func:`SortedList.add` parameter `val` renamed to `value`. |
| 49 | +* :func:`SortedList.__contains__` parameter `val` renamed to `value`. |
| 50 | +* :func:`SortedList.discard` parameter `val` renamed to `value`. |
| 51 | +* :func:`SortedList.remove` parameter `val` renamed to `value`. |
| 52 | +* :func:`SortedList.__delitem__` parameter `idx` renamed to `index`. |
| 53 | +* :func:`SortedList.__getitem__` parameter `idx` renamed to `index`. |
| 54 | +* :func:`SortedList.__setitem__` now raises :exc:`NotImplementedError`. Use |
| 55 | + :func:`SortedList.__delitem__` and :func:`SortedList.add` instead. |
| 56 | +* :func:`SortedList.bisect_left` parameter `val` renamed to `value`. |
| 57 | +* :func:`SortedList.bisect_right` parameter `val` renamed to `value`. |
| 58 | +* :func:`SortedList.bisect` parameter `val` renamed to `value`. |
| 59 | +* :func:`SortedList.count` parameter `val` renamed to `value`. |
| 60 | +* :func:`SortedList.append` now raises :exc:`NotImplementedError`. Use |
| 61 | + :func:`SortedList.add` instead. |
| 62 | +* :func:`SortedList.extend` now raises :exc:`NotImplementedError`. Use |
| 63 | + :func:`SortedList.update` instead. |
| 64 | +* :func:`SortedList.insert` now raises :exc:`NotImplementedError`. Use |
| 65 | + :func:`SortedList.add` instead. |
| 66 | +* :func:`SortedList.pop` parameter `idx` renamed to `index`. |
| 67 | +* :func:`SortedList.index` parameter `val` renamed to `value`. |
| 68 | +* :func:`SortedList.__add__` parameter `that` renamed to `other`. |
| 69 | +* :func:`SortedList.__iadd__` parameter `that` renamed to `other`. |
| 70 | +* :func:`SortedList.__mul__` parameter `that` renamed to `num`. |
| 71 | +* :func:`SortedList.__imul__` parameter `that` renamed to `num`. |
| 72 | +* `SortedList._make_cmp` renamed to `SortedList.__make_cmp`. |
| 73 | +* :func:`SortedKeyList.add` parameter `val` renamed to `value`. |
| 74 | +* :func:`SortedKeyList.__contains__` parameter `val` renamed to `value`. |
| 75 | +* :func:`SortedKeyList.discard` parameter `val` renamed to `value`. |
| 76 | +* :func:`SortedKeyList.remove` parameter `val` renamed to `value`. |
| 77 | +* :func:`SortedKeyList.bisect_left` parameter `val` renamed to `value`. |
| 78 | +* :func:`SortedKeyList.bisect_right` parameter `val` renamed to `value`. |
| 79 | +* :func:`SortedKeyList.bisect` parameter `val` renamed to `value`. |
| 80 | +* :func:`SortedKeyList.count` parameter `val` renamed to `value`. |
| 81 | +* :func:`SortedKeyList.append` now raises :exc:`NotImplementedError`. Use |
| 82 | + :func:`SortedKeyList.add` instead. |
| 83 | +* :func:`SortedKeyList.extend` now raises :exc:`NotImplementedError`. Use |
| 84 | + :func:`SortedKeyList.update` instead. |
| 85 | +* :func:`SortedKeyList.insert` now raises :exc:`NotImplementedError`. Use |
| 86 | + :func:`SortedKeyList.add` instead. |
| 87 | +* :func:`SortedKeyList.index` parameter `val` renamed to `value`. |
| 88 | +* :func:`SortedKeyList.__add__` parameter `that` renamed to `other`. |
| 89 | +* :func:`SortedKeyList.__radd__` added. |
| 90 | +* :func:`SortedKeyList.__iadd__` parameter `that` renamed to `other`. |
| 91 | +* :func:`SortedKeyList.__mul__` parameter `that` renamed to `num`. |
| 92 | +* :func:`SortedKeyList.__rmul__` added. |
| 93 | +* :func:`SortedKeyList.__imul__` parameter `that` renamed to `num`. |
| 94 | +* Removed `SortedDict.iloc`. Use :func:`SortedDict.keys` and |
| 95 | + :class:`SortedKeysView` instead. |
| 96 | +* :func:`SortedDict.fromkeys` parameter `seq` renamed to `iterable`. |
| 97 | +* :func:`SortedDict.keys` now returns :class:`SortedKeysView`. |
| 98 | +* :func:`SortedDict.items` now returns :class:`SortedItemsView`. |
| 99 | +* :func:`SortedDict.values` now returns :class:`SortedValuesView`. |
| 100 | +* Removed `SortedDict.viewkeys`. Use :func:`SortedDict.keys` instead. |
| 101 | +* Removed `SortedDict.viewitems`. Use :func:`SortedDict.items` instead. |
| 102 | +* Removed `SortedDict.viewvalues`. Use :func:`SortedDict.values` instead. |
| 103 | +* `SortedDict.iterkeys` removed. Use :func:`SortedDict.keys` instead. |
| 104 | +* `SortedDict.iteritems` removed. Use :func:`SortedDict.items` instead. |
| 105 | +* `SortedDict.itervalues` removed. Use :func:`SortedDict.values` instead. |
| 106 | +* `SortedDict.popitem` now accepts an optional `index` argument. Default |
| 107 | + ``-1``. |
| 108 | +* `sorteddict.KeysView` renamed to :class:`SortedKeysView`. |
| 109 | +* `sorteddict.ItemsView` renamed to :class:`SortedItemsView`. |
| 110 | +* `sorteddict.ValuesView` renamed to :class:`SortedValuesView`. |
| 111 | +* Sorted dict views rely on collections abstract base classes: dict views and |
| 112 | + sequence. The :func:`SortedKeysView.__getitem__`, |
| 113 | + :func:`SortedItemsView.__getitem__`, and :func:`SortedValuesView.__getitem__` |
| 114 | + methods are implemented and optimized. All other mixin methods use the |
| 115 | + default implementation provided by the base class. Prefer :class:`SortedDict` |
| 116 | + methods to view methods when possible. |
| 117 | +* `SortedSet._make_cmp` renamed to `SortedSet.__make_cmp`. |
| 118 | +* :func:`SortedSet.symmetric_difference` parameter `that` renamed to `other`. |
| 119 | +* :func:`SortedSet.symmetric_difference_update` parameter `that` renamed to |
| 120 | + `other`. |
| 121 | + |
| 122 | +**Miscellaneous** |
11 | 123 |
|
| 124 | +* Sphinx `autodoc` now used for API documentation. |
| 125 | +* All benchmarks now run on CPython 3.6 unless otherwise noted. |
| 126 | +* Testing now uses `pytest` rather than `nose`. |
| 127 | +* AppVeyor CI testing added. |
| 128 | +* Updated versions of alternative implementations. |
12 | 129 |
|
13 | 130 | 1.5.10 (2018-04-21)
|
14 | 131 | -------------------
|
|
0 commit comments