I am writing a package that needs some global constant variables. Although constant, these variables can be changed before doing anything else. For example, nproc
is the number of processors used. Since allowing global variables to change is dangerous, these variables should be locked after the package is imported.
The only method I come up with is to read a configuration file. However, as a python package (not an application), it is really weird that a configuration file is needed.
What's the correct way to handle such global configuration?
Edit:
it is important to notice that these variables is not something like pi
that will never change. It can be changed but should be constant during the usage of this package.