title: Reference iterator in parallel loop
body: <p>I'm trying to reference the iteration value <code>i</code> in a parallel loop using Joblib. I'm getting the error <code>NameError: name 'i' is not defined</code>. Below is my code:</p>
  
  <pre><code>def sub5():
      curveplots = []
      nodes = node_matrix[:,i,:].T
      curveplots = bezier.Curve(nodes, degree=2).evaluate_multi(np.linspace(0,1,bezier_precision)).T
      return curveplots
  curveplots = Parallel(n_jobs=-1,)(delayed(sub5)()for i in range(l))
  </code></pre>
  
  <p>I'm assuming this is because <code>i</code> is defined when I call <code>Parallel</code>, after the function <code>sub5</code>. But I'm not sure how to get around this. Any ideas? Thanks!</p>