An ordered dictionary for the Python library?

Neil Cerutti horpner at yahoo.com
Wed Sep 12 12:58:15 EDT 2007


On 2007-09-12, Mark Summerfield <m.n.summerfield at googlemail.com>
wrote:
> Actually I meant by key order, so insertion order doesn't
> matter at all. If you need a dictionary-like data structure
> that respects insertion order you could use a list of (key,
> value) tuples.
>
> Another respondent asked about use cases.

A mapping with sorted keys could theoretically be convenient when
your keys are comparable but not hashable.

-- 
Neil Cerutti



More information about the Python-list mailing list