Python Forum

Full Version: an object like a dictionary except ...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
is it possible to create an object that works like a dict (e.g. can be indexed by any hashable key) but an internal method is called for fetching and storing values which gets the key and the value to store and returns the value that results from fetching?
Sure, you could implement the abstract methods of collections.abc.MutableMapping.