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>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4