title: How to set interact arguments programmatically?
body: <p>Suppose I have function, that accepts list of arguments. List can be of variable length and function is ok with it. For example:</p>
  
  <pre><code>import math
  import numpy as np
  import matplotlib.pyplot as plt
  from ipywidgets import interact, interactive, fixed, interact_manual
  import ipywidgets as widgets
  %matplotlib inline  
  
  def PlotSuperposition(weights):
      def f(x):
          y = 0
          for i, weight in enumerate(weights):
              if i==0:
                  y+=weight
              else:
                  y += weight*math.sin(x*i)
          return y
      vf = np.vectorize(f)
      xx = np.arange(0,6,0.1)
      plt.plot(xx, vf(xx))
      plt.gca().set_ylim(-5,5)
  
  PlotSuperposition([1,1,2])
  </code></pre>
  
  <p>shows</p>
  
  <p><a href="https://i.stack.imgur.com/1055x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1055x.png" alt="enter image description here"></a></p>
  
  <p>I can hardcode interact for given number of arguments, like here</p>
  
  <pre><code>interact(lambda w0, w1, w2: PlotSuperposition([w0,w1,w2]), w0=(-3,+3,0.1), w1=(-3,+3,0.1), w2=(-3,+3,0.1))
  </code></pre>
  
  <p>which shows</p>
  
  <p><a href="https://i.stack.imgur.com/j7Iqw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j7Iqw.png" alt="enter image description here"></a></p>
  
  <p>But how can I make number of sliders defined programmatically?</p>
  
  <p>I tried</p>
  
  <pre><code>n_weights=10
  weight_sliders = [widgets.FloatSlider(
          value=0,
          min=-10.0,
          max=10.0,
          step=0.1,
          description='w%d' % i,
          disabled=False,
          continuous_update=False,
          orientation='horizontal',
          readout=True,
          readout_format='.1f',
      ) for i in range(n_weights)]
  interact(PlotSuperposition, weights=weight_sliders)
  </code></pre>
  
  <p>but got error</p>
  
  <pre><code> TypeError: 'FloatSlider' object is not iterable
  </code></pre>
  
  <p>inside <code>PlotSuperposition</code> saying that interact doesn't pass a list of values to the function.</p>
  
  <p>How to accomplish?</p>