I'd like to build a special dict class that has the option to export it's underlying dict as a whole (not just the individual items), i.e. something like this:
class CustomDict(dict):
def export(self):
return ??? # A dict instance
I know that I could simulate this behavior by simply building the export dict on the fly, or by storing the items in a separate class attribute in the first place, but I was wondering if there is a clean way of getting to the entire underlying dict directly. (Or am I overthinking this?)