Ask: how to enumerate the selection and combination of modules?

ask a question of choosing the best among different combinations of various modules.

assume that a main program is essentially a process, first A, then B, then C. But A, B, and C all have a variety of implementations. For example, A can be A1, or A2, or A3.

class A:
    def func_a(self):
        pass

class A1(A):
    def func_a1(self):
        pass
class A2(A):
    def func_a2(self):
        pass

therefore, the main program can adopt a combination of modules such as A1+B1:

if __name__ == "__main__":
    A1()
    B1()

the main program can also use a combination of modules like A2+B2:

if __name__ == "__main__":
    A2()
    B2()

but I don"t know whether the result of A1+B1 is better, the result of A2+B2 is better, or other combinations such as A1+B3 are the best.

is there a way to configure a config file that enumerates all combinations of An and B , and then let the main program run all the combinations one by one and find the best? Thank you. First!

Apr.24,2022

use itertools.product to manually arrange all combinations?

Menu