Adding a Par construct to Python?

Paul Rubin http
Wed May 20 06:20:03 CEST 2009

Steven D'Aprano <steven at> writes:
> (4) the caller is responsible for making sure he never shares data while 
> looping over it.
> I don't think I've missed any possibilities. You have to pick one of 
> those four. 

I wonder if the compiler can check that a given function doesn't
change any data.  Then:

def f(x):
   return x*sqrt(x) + 3      # does not mutate any data

def g(x): ...                # likewise

s = parallel_dot_product(parallel_map(f, vec), parallel_map(g,vec))

More information about the Python-list mailing list