Created
August 14, 2013 19:15
-
-
Save defuz/6234508 to your computer and use it in GitHub Desktop.
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 BaseModel(object): | |
def __init__(self, params, **params2): | |
self._data = dict(params, params2) | |
def __getattr__(self, name): | |
try: | |
return self._data[name] | |
except KeyError: | |
raise AttributeError(self, name) | |
def __iter__(self): | |
return self._data.iteritems() | |
@property | |
def as_dict(self): | |
return self._data.copy() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment