user1893354
user1893354

Reputation: 5938

Python Multiprocessing using *args

I am creating a python process in the following way

def make_process(p_num, *args):    
    p = multiprocessing.Process(
                        target=process_func, args=(args, p_num,))

The problem is that args is being passed to process_func as a tuple but I want to expand the tuple elements as a normal arguments. I tried args=(*args, p_num,) but this created a syntax error. Is there a way to expand the arguments?

Upvotes: 0

Views: 102

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798676

Add tuples.

args=args + (pnum,)

Upvotes: 3

Related Questions