On Thu, Oct 15, 2009 at 2:04 PM, markus kossner <[email protected]> wrote: > Hi, > let's simply start with an example: > > #!/usr/bin/python2.6 > import numpy as n > > def calculate(a,b=3,c=4): > print b > return n.sqrt(n.exp(a*b+c)/n.exp(c)**2) > > from multiprocessing import Pool > p = Pool(processes=2) > a_list=range(100000) > > result=p.map(calculate,a_list) > > This code works qite fine, as long as i yust want to map the > calculate function onto a list of values of a (the first argument of the > function). But what if I want to change the value of b in the compute > function to some other value, than the default one?
Pool.map() seems to only support a single parameter. I think you will have to redefine calculate() to take for example a dict parameter containing the actual arcuments. Kent _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
