[Python-Dev] Proposal: add odict to collections (original) (raw)

Hasan Diwan hasan.diwan at gmail.com
Sun Jun 15 06:38:01 CEST 2008


2008/6/14 Talin <talin at acm.org>:

There's been a lot of controversy/confusion about ordered dicts. One of the sources of confusion is that people mean different things when they use the term "ordered dict": In some cases, the term is used to mean a dictionary that remembers the order of insertions, and in other cases it is used to mean a sorted dict, i.e. an associative data structure in which the entries are kept sorted. (And I'm not sure that those are the only two possibilities.)

Have the comparison function passed in as a parameter then, if it's None, then have it maintain the order of insertion? Something like: def init(self, cmpfunc = None): self.dict = dict()

def getattr(self, key): try: return self.key

-- Cheers, Hasan Diwan <hasan.diwan at gmail.com>



More information about the Python-Dev mailing list