An ordered dictionary for the Python library?

Carl Banks pavlovevidence at gmail.com
Sat Sep 15 06:58:26 CEST 2007


On Thu, 13 Sep 2007 19:21:08 -0700, James Stroud wrote:

> Carl Banks wrote:
>> On Sep 13, 4:20 pm, James Stroud <jstr... at mbi.ucla.edu> 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?
>> 
>> 
> Do you mean, like, a SortedDict and an OrderedDict like I mentioned in
> the post you are replying to?


Like, you know, maybe I should read the whole article I reply to.


*sigh*


Carl Banks



More information about the Python-list mailing list