Note: I'm not a trained programmer: I don't know enough technical terms to ask my question more clearly. I have a Python module that generates six other modules. I have a pool of eight data points that are the ingredients for the modules. To generate a module, I grab between three and five data points and combine them in a specific way. It's sort of like the food assembly line at Taco Bell, you know? At the moment, I basically have six separate functions to generate the six modules. In isolation, each function is acceptable. But I have tons of duplicate code or similar code, and every function has some degree of overlap with each of the other functions. I have some common use functions, such as the logic that finalizes the assembly process and writes to disk. But trying to generalize subroutines isn't sufficient in this situation. Each module is currently generated independently, so the flow for each function is independent. I think it would be more efficient to have one flow to generate all modules, but I don't know how to conceptualize it. Or perhaps the problem is that I don't know how to keep things organized. This is the module I described above. In an older version of the module, I had one function that generated all modules at the same time. The flow control in that module is horrifying. Continue reading...