This package implements a treap-based dictionary-like interface for Python. There are two versions here - one is in pure Python, one is partly in Cython. The pure Python version may actually be a bit faster at about 100,000 values, but the Cython version is vastly faster for larger collections. The nest.py module is a quick demo of what you might use a treap for. It keeps the n lowest (or n highest) values from a potentially large series of values.