An ordered dictionary for the Python library?

Carl Banks pavlovevidence at gmail.com
Wed Sep 12 12:18:41 EDT 2007


On Sep 12, 8:42 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Wed, 12 Sep 2007 07:33:45 +0000, Mark Summerfield wrote:
> > I feel that Python lacks one useful data structure: an ordered
> > dictionary.
>
> > I find such data structures v. useful in C++.
>
> [snip]
>
> Personally, I've never missed an ordered dict. What do people use them
> for?

I once had a GUI that displayed the contents of a dict as a tree.  The
user could add entries, and the entries would display at the end.
Hence, the ordered dict.

I could have kept the order separately, but what was the point?  I
just whipped up a homemade ordered dict class, it worked fine, and I
didn't have to worry about keeping them synchronized.


Carl Banks




More information about the Python-list mailing list