Skip to content

Instantly share code, notes, and snippets.

@mgrouchy
Created May 31, 2012 17:34
Show Gist options
  • Save mgrouchy/2844942 to your computer and use it in GitHub Desktop.
Save mgrouchy/2844942 to your computer and use it in GitHub Desktop.
class AttrDict(dict):
"""override dict class so we can access attributes using 'dot' notation
ex/ dict.value
"""
def __init__(self, **kwargs):
dict.__init__(self, kwargs)
self.__dict__ = self
def __getstate__(self):
return self
def __setstate__(self, state):
self.update(state)
self.__dict__ = self
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment