I want to define a function like the following in a class:
class multiprocessing_np_arr_base_class(object):
def pool_init(self, _shr_var1, _shar_var2, _shr_var3,...):
global shr_var1
shr_var1 = _shr_var1
global shr_var2
shr_var2 = _shr_var2
global shr_var3
shr_var3 = _shr_var3
...
The pool_init is very tedious to write. Is it possible to define a function that automatically do the two lines (global x, x = _x) for each variable x given to the function?
The pool_init function is an imitation of J.F. Sebastian's answer at Use numpy array in shared memory for multiprocessing. I am currently using python 2.7.
Thanks for your help.