Skip to content

Instantly share code, notes, and snippets.

@ErisianArchitect
Created August 12, 2015 12:17
Show Gist options
  • Save ErisianArchitect/5d8cf87c92979b6a4960 to your computer and use it in GitHub Desktop.
Save ErisianArchitect/5d8cf87c92979b6a4960 to your computer and use it in GitHub Desktop.
#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