In <mailman.1461.1286539843.29448.python-l...@python.org> "Jonas H." <jo...@lophus.org> writes:
>On 10/08/2010 02:23 AM, kj wrote: >Here's my implementation suggestion: >class frozendict(dict): > def _immutable_error(self, *args, **kwargs): > raise TypeError("%r object is immutable" % self.__class__.__name__) > __setitem__ = __delitem__ = clear = pop \ > = popitem = setdefault = update = _immutable_error > def __hash__(self): > return hash(frozenset(self.iteritems())) >Only 9 lines :-) Thanks, you just answered the question I just posted, while I was still writing it! ~kj -- http://mail.python.org/mailman/listinfo/python-list