def run_threads(collection, target):
 threads = []
 for i in range(NTHREADS):
  bound_target = partial(target, collection, i)
  threads.append(threading.Thread(target=bound_target))
 for t in threads:
  t.start()
 for t in threads:
  t.join(30)
  assert (not t.isAlive())

def run_threads ( collection , target ) : threads = [ ] for i in range ( NTHREADS ) : bound_target = partial ( target , collection , i ) threads . append ( threading . Thread ( target = bound_target ) ) for t in threads : t . start ( ) for t in threads : t . join ( 30 ) assert ( not t . isAlive ( ) )
run a target function in many threads .