Python: how to make a recursive generator function
问题 I have been working on generating all possible submodels for a biological problem. I have a working recursion for generating a big list of all the submodels I want. However, the lists get unmanageably large pretty fast (N=12 is just possible in the example below, N>12 uses too much memory). So I wanted to convert it to a generator function using yield instead, but I'm stuck. My working recursive function looks like this: def submodel_list(result, pat, current, maxn): ''' result is a list to