Why are there no sorted containers in Python's standard libraries?

后端 未结 6 1009
执念已碎
执念已碎 2020-12-02 18:06

Is there a Python design decision (PEP) that precludes a sorted container from being added to Python?

(OrderedDict is not a sorted container since it is

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-02 18:36

    Not exactly a "sorted container", but you might be interested in the standard library's bisect module, which "provides support for maintaining a list in sorted order without having to sort the list after each insertion".

提交回复
热议问题