1 def update_dict(d, **replace):
3 for k, v in replace.iteritems():
10 class frozendict(dict):
14 rval = getattr(self, '_hash', None)
16 rval = self._hash = hash(frozenset(self.iteritems()))
19 class frozenlist(list):
23 rval = getattr(self, '_hash', None)
25 rval = self._hash = hash(tuple(self))
29 if isinstance(x, list):
30 return frozenlist(immutify(y) for y in x)
31 elif isinstance(x, dict):
32 return frozendict((immutify(k), immutify(v)) for k, v in x.iteritems())
34 hash(x) # will throw error if not immutable