Reputation: 7
While creating the thread in the traditional way, I want to pass the list and dictionary objects; how to do that?
for example:
def expectslist(**kwargs):
list=kwargs.values -- not working
def expectsdict(**kwargs):
dictobject=kwargs.values -- not working
def main():
thread1 = Thread(target =expectslist, (args=mylist)) # mylist is list of objects
thread2 = Thread(target =expectsdict, (args=mydict)) # mydict is dictionary of objects (key-objects pair)
Upvotes: 0
Views: 96
Reputation: 23815
the value of args
is a tuple
that holds the thread func arguments.
Example:
def my_sum(x,y):
return x + y
Thread(target = my_sum,args = (5,9))
Upvotes: 1