Mostly you shouldn't subclass #Python built-in types. But if you do, dict subclasses can define __missing__: it's called when a key is missing. Instead of hiding a dict in a function as a cache, how about hiding a function in a dict!? A Fibonacci dictionary:
@nedbat you are describing a namespace. Used to build dynamic classes.
Spend time learning how to create dynamic classes
This is where to start
https://docs.python.org/3/library/types.html#types.new_class
properties, method, classmethod, staticmethod all have their own boilerplate wrappers.