Created
March 15, 2011 17:07
-
-
Save fredrick/871050 to your computer and use it in GitHub Desktop.
Dynamically define object variables/methods at instantiation (quick mock)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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