Skip to content

Instantly share code, notes, and snippets.

@fredrick
Created March 15, 2011 17:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredrick/871050 to your computer and use it in GitHub Desktop.
Save fredrick/871050 to your computer and use it in GitHub Desktop.
Dynamically define object variables/methods at instantiation (quick mock)
class Stub(object):
def __init__(self, **kwargs):
for key in kwargs:
setattr(self, key, kwargs[key])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment