No trees in the stdlib?

Raymond Hettinger python at rcn.com
Sat Jun 27 01:22:18 CEST 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.


Raymond



More information about the Python-list mailing list