Background
- I have two files in a project. 'main.py' and 'auxillary_functions.py'. 'main.py' contains the basic code and the other file contains supporting information.
In the main file, I iterate over several cases. For each case, I have to initialize a large number of parameters e.g.
for i in range(10): zP1HHSet, zH1HHSet, zISHHSet, zEEHHSet = [], [], [], [] dP1HHSet, dH1HHSet, dISHHSet, dEEHHSet = [], [], [], [] mP1HHSet, mH1HHSet, mISHHSet, mEEHHSet = [], [], [], [] nP1HHSet, nH1HHSet, nISHHSet, nEEHHSet = [], [], [], [] kP1HHSet, kH1HHSet, kISHHSet, kEEHHSet = [], [], [], [] tP1HHSet, tH1HHSet, tISHHSet, tEEHHSet = [], [], [], [] a_IS = 0 b_IS = 10401 and so on
This is a small subset of parameters that I need to initialize for every run.
Problem
What I want to do is to write a function, say, foo:
def foo(case):
zP1HHSet, zH1HHSet, zISHHSet, zEEHHSet = [], [], [], []
dP1HHSet, dH1HHSet, dISHHSet, dEEHHSet = [], [], [], []
mP1HHSet, mH1HHSet, mISHHSet, mEEHHSet = [], [], [], []
nP1HHSet, nH1HHSet, nISHHSet, nEEHHSet = [], [], [], []
kP1HHSet, kH1HHSet, kISHHSet, kEEHHSet = [], [], [], []
tP1HHSet, tH1HHSet, tISHHSet, tEEHHSet = [], [], [], []
One option known to me is to return all the variables one by one and then unpack them in the main file. Is there any better way of handling this problem?
Question
How to import a large number of variables? In short I want to reduce the main code size by transferring this group of lines to another file.