Skip to content

Instantly share code, notes, and snippets.

@JamieHouston
Created April 10, 2012 18:33
Show Gist options
  • Save JamieHouston/2353540 to your computer and use it in GitHub Desktop.
Save JamieHouston/2353540 to your computer and use it in GitHub Desktop.
Dynamic class in python, instead of using a dictionary
# Dynamic class
# Instantiate with bla=Dyamic(x=1, y=2)
# then just set of call like bla.foo = True
class Dynamo:
__init__ = lambda self, **kw: setattr(self, '__dict__', kw)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment