title: How to extend an array in-place in Numpy?
body: <p>Currently, I have some code like this</p>
  
  <pre><code>import numpy as np
  ret = np.array([])
  for i in range(100000):
    tmp =  get_input(i)
    ret = np.append(ret, np.zeros(len(tmp)))
    ret = np.append(ret, np.ones(fixed_length))
  </code></pre>
  
  <p>I think this code is <strong>not efficient</strong> as <code>np.append</code> needs to return a copy of the array instead of <strong>modify the ret in-place</strong></p>
  
  <p>I was wondering whether I can use the <code>extend</code> for a numpy array like this:</p>
  
  <pre><code>import numpy as np
  from somewhere import np_extend
  ret = np.array([])
  for i in range(100000):
    tmp =  get_input(i)
    np_extend(ret, np.zeros(len(tmp)))
    np_extend(ret, np.ones(fixed_length))
  </code></pre>
  
  <p>So that the <code>extend</code> would be much more efficient.
  Does anyone have ideas about this?
  Thanks!</p>