Indeed, this is missing from the documentation, and I found it confusing. With some fiddling, I learned that @parallel
will pass tuples as arguments:
@parallel
def func(n,color='red'):
sleep(2)
return [n^2,color]
L=[2,(4,'blue'),5,(6,'green'),7]
r = func(L)
The output is as expected:
for s in r:
print "func(%s) = %s"%(s[0][0][0],s[1])
func((2,)) = [4, 'red']
func((4, 'blue')) = [16, 'blue']
func((5,)) = [25, 'red']
func((6, 'green')) = [36, 'green']
func((7,)) = [49, 'red']
UPDATE: Ok, I guess I have time to at least create the ticket ;) This is now ticket 11462!
Can you post a sample code to explain what you are trying to do? The most natural solution would be to pass an array.