I am trying to subclass a python dict and I am not sure how to get it to work exactly.
What I am trying to create is basically a cache mechanism tied to the key value in the dict so I can do a kind of lazy loading of the data. When I create the object I pass it a data source. By default it will have no keys. I want to have the Class return the data if it's already loaded or load the data if it's missing. Hope that makes sense. I included a rough example of what I am trying to do.
self.data = data
if not self.has_key(key):
self[key] = self.data.getDataForKey( key )