brad wrote: > There is only one '1' key in your example. I need multiple keys that are all > '1'. I thought Python would have something built-in to handle this sort of > thing. > > I need a true multimap ... without making K's value a list of stuff > to append to.
That's what a multimap is. If you really need the syntactic sugar, it's simple to implement: class multidict(dict): def __setitem__(self, key, value): try: self[key].append(value) except KeyError: dict.__setitem__(self, key, [value]) -Miles -- http://mail.python.org/mailman/listinfo/python-list