sortedcontainers
Sorted Containers -- Sorted List, Sorted Dict, Sorted Set
Install
sortedcontainers on PyPI
pip
pip install sortedcontainersuv
uv add sortedcontainerspoetry
poetry add sortedcontainersPackage facts
| License | Apache 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,915 days since the last release |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: sortedcontainers-2.4.0-py2.py3-none-any.whl
About sortedcontainers
from the package's own PyPI description — quoted content, verbatim
Python Sorted Containers
Sorted Containers is an Apache2 licensed sorted collections library,
written in pure-Python, and fast as C-extensions.
Python's standard library is great until you need a sorted collections type. Many will attest that you can get really far without one, but the moment you really need a sorted list, sorted dict, or sorted set, you're faced with a dozen different implementations, most using C-extensions without great documentation and benchmarking.
In Python, we can do better. And we can do it in pure-Python!
.. code-block:: python
>>> from sortedcontainers import SortedList
>>> sl = SortedList(['e', 'a', 'c', 'd', 'b'])
>>> sl
SortedList(['a', 'b', 'c', 'd', 'e'])
>>> sl *= 10_000_000
>>> sl.count('c')
10000000
>>> sl[-3:]
['e', 'e', 'e']
>>> from sortedcontainers import SortedDict
>>> sd = SortedDict({'c': 3, 'a': 1, 'b': 2})
>>> sd
SortedDict({'a': 1, 'b': 2, 'c': 3})
>>> sd.popitem(index=-1)
('c', 3)
>>> from sortedcontainers import SortedSet
>>> ss = SortedSet('abracadabra')
>>> ss
SortedSet(['a', 'b', 'c', 'd', 'r'])
>>>...
Similar packages
permissive · top 1,000 on PyPI
Djangopermissive · top 1,000 on PyPI
pyroaringpermissive · top 1,000 on PyPI
orderly-setpermissive · top 1,000 on PyPI
pyicebergpermissive · top 1,000 on PyPI
natsortpermissive · top 1,000 on PyPI
argparsepermissive · top 1,000 on PyPI
daskpermissive · top 1,000 on PyPI
pycodestylepermissive · top 1,000 on PyPI
outcomepermissive · top 1,000 on PyPI