[Python-ideas] ordered dict

Mathias Panzenböck grosser.meister.morti at gmx.net
Fri Apr 20 17:41:19 CEST 2007


Some kind of ordered dictionary would be nice to have in the
standard library. e.g. a AVL tree or something like that.
It would be nice so we can do things like that:

for value in tree[:end_key]:
	do_something_with(value)

del tree[:end_key]


A alternative would be just to sort the keys of a dict but
that's O( n log n ) for each sort. Depending on what's the more
often occurring case (lookup, insert, get key-range, etc.) a
other kind of dict object would make sense.

What do you think?


	-panzi



More information about the Python-ideas mailing list