title: Vectorize Indexing first n elements
body: <p>I'm trying to vectorize the following for-loop</p>
  <pre><code>for n in range(N):
    x = np.empty(n)
    x = array[:n]
    #do something with x
  </code></pre>
  <p>In particular I would like to use something like</p>
  <pre><code>x = np.empty(shape = [N, range(N)])    
  x[:] = array[:range(N)]
  #do something with x
  </code></pre>
  <p>but obviously this doesen't work. What is the best way to do this?</p>