The PY file format means using Python code as the configuration file. This pairs nicely with the use of the same language implementing the application. We will have a configuration file that's simply a module; the configuration is written in the Python syntax. This can remove the need for sophisticated parsing to get the configuration values.
Using Python gives us a number of design considerations. We have two overall strategies to use Python as the configuration file:
- A top-level script: In this case, the configuration file is simply the top-most main program.
- An exec() import: In this case, our configuration file provides parameter values that are collected into module global variables.
We can design a top-level script file that looks like the following code:
from simulator import *
def simulate_SomeStrategy_Flat() -> None:
dealer_rule...