Created
August 12, 2015 12:17
-
-
Save ErisianArchitect/5d8cf87c92979b6a4960 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
#There is definitely a better way to write this class | |
#Basically just like a dict, except you can use instance.attribute | |
#rather than instance["attribute"] | |
class Settings: | |
def __init__(self, **kwargs): | |
for key in kwargs: | |
setattr(self,key,kwargs[key]) | |
def __setitem__(self,key,value): | |
setattr(self,key,value) | |
def __getitem__(self,key): | |
return getattr(self,key,None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment