func): __multi_run(name, kset, func): results = [] kmap = {} for key in kset: if key[0] not in kmap: kmap[key[0]] = set([]) kmap[key[0]].append(key) i , threadpool = 0, [] for split_key, hset in kmap.iteritems(): results.insert(i, None) tt = threading.Thread(target=func, args=(name, split_key, hset,results[i])) tt.start() threadpool.append(tt) i = i+ 1 for i in xrange(0, len(kmap), 1): threadpool[i].join() return results �线性扩展