THINGS THAT HAPPEN
import UserDict,os class WriteFileCacheDict (UserDict.UserDict): def __getitem__ (self, key): if not self.data.has_key(key): self.data[key] = open (key, 'w+') return self.data[key] class MagicalFileDict (WriteFileCacheDict): def __getitem__ (self, key): if not self.data.has_key(key): d = os.path.dirname(key) if not os.path.isdir(d): os.makedirs(d) return WriteFileCacheDict.__getitem__(self, key)