An ordered dictionary for the Python library?

James Stroud jstroud at mbi.ucla.edu
Fri Sep 14 22:23:51 CEST 2007


Mark Summerfield wrote:
> I guess I'll have to rename my module (although unfortunately, my book
> has just gone into production and I have a (simpler) example of what I
> considered to be an ordered dict, so I will be adding to the
> terminology confusion). That notwithstanding, given that it is a
> sorteddict, how is the API?

I must think the API good because I have been implementing, in parallel 
with this discussion, my own "OrderedDict" with a very similar API (this 
is part of a larger project where I recently found the need to have a 
well-implemented ordered dict). The only real omission I see is to allow 
instantiating a "sorted dict" with an optional cmp function--to allow 
the generalization of such features as case-independence, etc.

James



More information about the Python-list mailing list