nergal wrote:Wouldn't it be cleaner under a dict?
Not necessarily. What you have looks less readable to me than each one having it's own global variable independently importable by any other module. I have used dictionaries for cvars in the past, but only for dynamically named variables:
https://github.com/satoon101/Projectile ... /config.pyIn that plugin, I create variables for each projectile type, which is dependent on the game. Due to this, I chose the option of a dictionary because I can store all the variables using the projectile type as a key.
You also run a greater risk of overwriting a key in a dictionary in this respect than doing the same with a global name. If you are using a modern Python editor (which I would highly recommend if you are not), most good ones will let you know if you are reusing/reassigning an existing global name (at the very least when you have not "used" the original object). They typically don't do the same for keys in a dictionary.
Even if you use a dictionary in this instance, I would question adding the ConfigManager to that same dictionary. There is really no reason to store that object anywhere, as it should really end its usefulness after you write and execute the configuration file. Speaking of, you are not executing the config in your code, so your plugin will always use the default values. I prefer using the context manager to automatically write and execute each configuration file. It looks like we never added either of those to the wiki. I will try to remember to do that later.