An ordered dictionary for the Python library?
michele.simionato at gmail.com
Wed Sep 12 09:47:51 CEST 2007
On Sep 12, 9:33 am, Mark Summerfield <m.n.summerfi... at googlemail.com>
> I feel that Python lacks one useful data structure: an ordered
> I find such data structures v. useful in C++. I know that in Python
> the sort function is v. fast, but often I prefer never to sort but
> simply to use an ordered data structure in the first place.
> (I'm aware that for ordered lists I can use the bisect module, but I
> want an ordered key-value data structure.)
> I think other people must find such things useful. There are three
> implementations on the Python Cookbook site, and one on PyPI, all in
> pure Python (plus I have my own implementation, also pure Python).
> I would suppose that it would be better if it was implemented in C---
> for example, my own pure Python ordered dict loads data about eight
> times slower than the built-in dict. Nonetheless, I still find it
> worth using for the convenience it offers.
> Do other Python programmers feel this lack? Is this worth a PEP?
Yes, this is a serious lack in the standard library.
More information about the Python-list