Adding a Par construct to Python?

Paul Rubin http
Wed May 20 00:20:03 EDT 2009


Steven D'Aprano <steven at REMOVE.THIS.cybersource.com.au> 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:

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

@pure
def g(x): ...                # likewise

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




More information about the Python-list mailing list