sorted containers sorted list sorted dict sorted set sorted containers is an apache2 licensed containers library written in purepython and fast as cextensions 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 dict or set you re faced with a dozen different implementations most using cextensions without great documentation and benchmarking in python we can do better and we can do it in purepython from sortedcontainers import sortedlist sl sortedlist e a c d b sl sortedlist a b c d e sl 1000000 sl count c 1000000 sl3 e e e from sortedcontainers import sorteddict sd sorteddict c 3 a 1 b 2 sd sorteddict a 1 b 2 c 3 sd popitemindex1 c 3 from sortedcontainers import sortedset ss sortedset abracadabra ss sortedset a b c d r ss bisectleft c 2 sorted containers takes all of the work out of python sorted types making your deployment and use of python easy there s no need to install a c compiler or prebuild and distribute custom extensions performance is a feature and testing has 100 coverage with unit tests and hours of stress c 20142019 by grant jenks license apache 2 0 see license for more details pylint disablereimported pylint disable reimported
from .sortedlist import SortedList, SortedKeyList, SortedListWithKey
from .sortedset import SortedSet
from .sorteddict import (
    SortedDict,
    SortedKeysView,
    SortedItemsView,
    SortedValuesView,
)

try:
    from ._sortedlist import SortedList, SortedKeyList, SortedListWithKey
    from ._sortedset import SortedSet
    from ._sorteddict import (
        SortedDict,
        SortedKeysView,
        SortedItemsView,
        SortedValuesView,
    )
except ImportError:
    pass

__all__ = [
    'SortedList',
    'SortedKeyList',
    'SortedListWithKey',
    'SortedDict',
    'SortedKeysView',
    'SortedItemsView',
    'SortedValuesView',
    'SortedSet',
]

__title__ = 'sortedcontainers'
__version__ = '2.4.0'
__build__ = 0x020400
__author__ = 'Grant Jenks'
__license__ = 'Apache 2.0'
__copyright__ = '2014-2019, Grant Jenks'