Grant Jenks - Python Sorted Collections - PyCon 2016
Why Stack Overflow recommends it
Stack Overflow users link it when explaining how SortedList really works internally and why sortedcontainers is fast enough to prefer over hand-rolled structures.
Recommended by 1 people across 1 different months, 2019 to 2022.
What it is
Grant Jenks presents his SortedContainers library at PyCon 2016, which offers sorted list, dict and set types written in pure Python. The talk explains how the implementation works and why it often outperforms C-extension alternatives.
What people said
Recommends kcsquared · 2022-02 · Stack Overflow · on “how does SortedList from sortedcontainers really work? Is it really a balanced BST?”
I'll also link a PyCon talk from the creator [this video] about its implementation and performance. But the extremely short answer is no, it isn't using a balanced BST and those asymptotics are approximate.
Cites user4815162342 · 2019-01 · Stack Overflow · on “How to push items off of asyncio.PriorityQueue when it is at maxsize and I put() new items?”
@JimMischel Sure, implementing one's own min-max heap is always an option. But if my task were to implement a priority queue, I'd prefer re-using a field-tested and debugged module, which is also useful for other things. Also, beating sortedcontainers may not be as easy as it seems, as quite some thought [this video] has entered into making them efficient.
Cites Reblochon Masque · 2020-06 · Stack Overflow · on “Data structures for efficiently finding small intersections of large collections”
It is indeed hard to tell without testing with your own data; the performance tests look like they were seriously conducted, and show good results for large, medium and small datasets for `intersection` and `intersection_update`: performance tests [LINK] (scroll to 2/3rd of the page down) - there is a talk at 2017 pycon [this video]