Here is a simple example of using keyword arguments in a function call. Nothing special.
def foo(arg1,arg2, **args): print arg1, arg2 print (args) print args['x'] args ={'x':2, 'y':3} foo(1,2,**args)
What print, as expected:
1 2 {'y': 3, 'x': 2} 2
I am trying to pass the same style keyword arguments for a multiprocessing task, but using ** in the args list is a syntax error. I know that my function, stretch () will take two positional arguments and n keyword arguments.
pool = [multiprocessing.Process(target=stretch, args= (shared_arr,slice(i, i+step),**args)) for i in range (0, y, step)]
Is it possible to pass keyword arguments to multiprocessor .Process? If so, how? If not, why?
python arguments multiprocessing
Jzl5325
source share