No trees in the stdlib?

Raymond Hettinger python at
Fri Jun 26 19:22:18 EDT 2009

[João Valverde]
> What's lacking is an associative array that preserves ordering, doesn't
> require a hash function and has fast insertions and deletions in
> O(log(n)).

FWIW, Py3.1 has an OrderedDict() that preserves insertion order.
It has O(1) lookup, deletion, insertion, and popping; and O(n)
iteration.  The ASPN Cookbook has equivalent code that runs on
earlier versions of Python.

> in Python. And I really enjoy the using this language.

Am glad you like it.


More information about the Python-list mailing list