This is not my code but I have a similar problem:
https://gist.github.com/songrotek/0c64d10cab5298c63cd0fc004a94ba1f
There are many parameters I want to edit and change in one central place (in the most semantic way possible) and then use to construct classes, run the main program etc.. Because I don't want to put everything in one file (it's too big, I need modules and different namespaces) and declare global variables. Having to edit the code for setting some parameters doesn't seem to be a good solution.
class Example:
def __init__(self, *initial_data, **kwargs):
for dictionary in initial_data:
for key in dictionary:
setattr(self, key, dictionary[key])
for key in kwargs:
setattr(self, key, kwargs[key])
Using constructors like this for being able to use dictionaries for init doesn't seem to be transparent enough.
What are possible solutions for this problem? It's still code mostly used by me and rather small, so it should be a good compromise between lightweight/appropriate for the size and still easy to use and comfortable.