13.3 Using Python for configuration files
In addition to syntax like TOML for providing configuration data, we can also write files in Python notation; it’s elegant and simple. It offers tremendous flexibility, since the configuration file is a Python module.
13.3.1 Getting ready
Python assignment statements are particularly elegant for creating configuration files. The syntax can be simple, easy to read, and extremely flexible. If we use assignment statements, we can import an application’s configuration details from a separate module. This could have a name like settings.py to show the module’s focus on configuration parameters.
Because Python treats each imported module as a global Singleton object, we can have several parts of an application all use an import settings statement to get a consistent view of the current, global application configuration parameters. We don’t need to worry about managing...