An ordered dictionary for the Python library?

Carl Banks pavlovevidence at
Fri Sep 14 03:36:25 CEST 2007

On Sep 13, 4:20 pm, James Stroud <jstr... at> wrote:
> Mark Summerfield wrote:
> > - If an item is inserted it is put in the right place (because the
> > underlying data structure, b*tree, skiplist or whatever is
> > intrinsically ordered by < on the key)
> +1 for all your suggestions below, but -1 for the above. You suggest that
>    myOrderedDict['key'] = value
> would place it in the dictionary in sorted order depending on 'key'.
> More natural to some of us (or maybe its just me) would be to append the
> key/value pair to the end of items.

Or, maybe, like, you know, you could have two different types that
maintain two different orders?

Carl Banks

More information about the Python-list mailing list