I heard threading is not very efficient in Python (compared to other languages).
Is this true? If so, how can a Python programmer overcome this?
after finding solution (below) I wonder why python still has threading class
from multiprocessing import Pool
def some_function(x):
return x*x
Xs = [i for i in xrange(1, 1000)] # make 1, 2, ..., 999, 1000
pool = Pool(processes=16) # start 16 worker processes on 16 CPU
print pool.map(some_function, Xs) # print out