joshjaysalazar / IntelliCaster

An AI race commentator for iRacing
GNU General Public License v3.0
3 stars 0 forks source link

Combine global settings into a common file for cleaner code #45

Closed joshjaysalazar closed 10 months ago

joshjaysalazar commented 10 months ago

Is your feature request related to a problem? Please describe. At the moment, there are a number of values being passed through multiple objects, and the code is starting to get confusing to read. For example, most classes have a self.settings attribute which has been passed through all the way from main.py.

Describe the solution you'd like A common.py file containing all of the variables which are required globally would alleviate this issue. This could also potentially solve a number of future bugs in the form of variables not being refreshed between parent and child.

Describe alternatives you've considered Something like a temporary JSON file might work, but that would require reading that JSON file over and over again, which seems like a less than ideal solution.

Additional context The common.py approach is one I've used before, and it works extraordinarily well for essentially global variables across a multi-file Python project.