Created
May 19, 2015 02:15
-
-
Save nad2000/69848382648356a57e25 to your computer and use it in GitHub Desktop.
Simple configuration implementation form dictionary
This file contains hidden or 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 configuration(dict): | |
def __getattr__(self, name): | |
return self.get(name) | |
def __setattr__(self, name, value): | |
self[name] = value | |
### | |
conf = configuration() | |
conf.aaa = 893282 | |
conf.aaa | |
conf.aaa = "aaa" | |
conf.aaa | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment