Skip to content

Instantly share code, notes, and snippets.

@mdellavo
Created April 23, 2010 19:59
Show Gist options
  • Save mdellavo/377093 to your computer and use it in GitHub Desktop.
Save mdellavo/377093 to your computer and use it in GitHub Desktop.
# Courtesy of http://norvig.com/python-iaq.html?a
class Struct(object):
def __init__(self, **kwargs):
self.update(kwargs)
def update(self, d):
self.__dict__.update(d)
def __repr__(self):
return 'Struct(%s)' % ', '.join('%s=%s' % (k, repr(v)) for (k,v) in vars(self).items())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment