title: How to define variable-size numpy array efficiently?
body: <p>I am looking for an efficient way to define a variable-size array working with the numpy module, knowing that the performance can be achieved only with the fixed-size arrays.</p>
  
  <p>My solution is to define a list (or tuple) as:</p>
  
  <pre><code>test = [0] * 10
  </code></pre>
  
  <p>and then define each element of "test" with a numpy array as:</p>
  
  <pre><code>test[0] = numpy.array([1,2,3])
  test[1] = numpy.array([4,5])
  ...
  </code></pre>
  
  <p>I guess this may lead to a scatter memory addressing when using such variable-size array, although vector-computing is maintained for each element of "test" as before.</p>
  
  <p>So, I would appreciate some help, if there is an efficient way around to define such arrays with the numpy module?</p>