
Nov. 27, 2013
4:34 p.m.
I just wrote up a class that allows dicts to be be pb.Cacheable. Everything works hunky-dory but only if I implement __hash__, which is problematic for mutable objects for reasons explained thoroughly elsewhere. The problem comes from twisted.spread.flavors.RemoteCacheObserver: class RemoteCacheObserver: ... def __hash__(self): """Generate a hash unique to all L{RemoteCacheObserver}s for this broker/perspective/cached triplet """ return ( (hash(self.broker) % 2**10) + (hash(self.perspective) % 2**10) + (hash(self.cached) % 2**10)) As we can see, self.cached (which is the pb.Cacheable instance) must be hashable. Why?