Passing list input as a single argument to starmap in Python 3.X
<p>I'm fairly new to python, so I apologize in advance if there are some stupid questions in here.</p>

<p>I'm trying to trying to parallelize a code, and in order to keep things semi-modular I need to pass several scalar values and one list from one function to another within Pool, like so:</p>

<pre><code>with Pool(nProcs) as p:
        out1= np.array(p.starmap(function1, product(arg1, arg2, ... argN)), dtype=object)
        T_in = [out1[0,3]]
        P_in = [out1[0,5]]
        XALL = [out1[0,6]]
        out2 = np.array(p.starmap(function2, product(P_in, T_in, ..., XALL)), dtype=object)
</code></pre>

<p>The concern is in the input to the out2 line.  Basically I am passing a combination of single values and lists.  Most of these lists are passed through product so that I can iterate on them, but I need to get one list from function1 output into function2 without having product iterate through each value (i.e. passing XALL as a "block").  Obviously, the way I have it listed above it treats XALL like any other list, but if I pop XALL out of product like so:</p>

<pre><code>result = np.array(p.starmap(psr, [product(Ppsr_in, T_rise_list, Eff_list, T_tol, Tpsr_in), XALL]), dtype=object)
</code></pre>

<p>that also doesn't work because starmap complains that I haven't given function2 enough arguments.</p>

<p>How can I pass this array to function2 and have it treated as a single iterable within a given process?</p>

<p>Thanks</p>

<p><strong>EDIT:</strong></p>

<p>As a clarification, P_in and T_in are scalar values (they could be a list as well, and in earlier versions of this code they are), but XALL is a list containing a series of values that I need to pass in to a function but do NOT want to iterate through the individual values.  Those values need to be treated as a single array, because each value in the array represents a mole fraction of a single chemical species (within the context of the overall code).  If I pass it in as just <code>XALL</code> product will treat it like any other list and treat each value as a different case to be run.  I just need this information to move from one function to another.</p>