Skip to content

Instantly share code, notes, and snippets.

@peterbe peterbe/gist:1021777
Created Jun 12, 2011

Embed
What would you like to do?
class dict_plus(dict):
def __init__(self, *args, **kwargs):
if 'collection' in kwargs: # excess we don't need
kwargs.pop('collection')
dict.__init__(self, *args, **kwargs)
self._wrap_internal_dicts()
def _wrap_internal_dicts(self):
for key, value in self.items():
if isinstance(value, dict):
self[key] = dict_plus(value)
def __getattr__(self, key):
return self[key]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.