logoalt Hacker News

Retr0idyesterday at 8:09 PM0 repliesview on HN

It's not exposed for general use (yet?) but cpython does internally contain an implementation of the HAMT data structure: https://github.com/python/cpython/blob/main/Python/hamt.c

Set/Delete/Lookup are all O(log(n))

See also: https://github.com/MagicStack/immutables (for something you can actually use)

p.s. I think the reason heapq isn't a type is that it's ancient code that's hung around from the early days of python.