How to get the return value from a thread?
One way I’ve seen is to pass a mutable object, such as a list or a dictionary, to the thread’s constructor, along with a an index or other identifier of some sort. The thread can then store its results in its dedicated slot in that object. For example: def foo(bar, result, index): print ‘hello {0}’.format(bar) … Read more