title: Extract a larger slice than the numpy array's size
body: <p>I want to extract a slice of length 10, beginning at index 2, of a numpy array <code>A</code>:</p>
  
  <pre><code>import numpy 
  
  A = numpy.array([1,3,5,3,9])
  
  def bigslice(A, begin_at, length):
      a = A[begin_at:begin_at + length]
      while len(a) + len(A) &lt; length:
          a = numpy.concatenate((a,A))
      return numpy.concatenate((a, A[:length-len(a)]))
  
  print bigslice(A, begin_at = 2, length = 10)
  #[5,3,9,1,3,5,3,9,1,3]
  </code></pre>
  
  <p>This is correct. But I'm looking for a more efficient way to do this (especially when I'll have arrays of thousands of elements at the end) : I suspect the <code>concatenate</code> used here to recreate lots of new temporary arrays, and that would be un-efficient.</p>
  
  <p><strong>How to do the same thing more efficiently ?</strong></p>