Fastest way to left-cycle a numpy array (like pop, push for a queue) : <p>With numpy arrays, I want to perform this operation:</p>

<ul>
<li>move <code>x[1],...,x[n-1]</code> to <code>x[0],...,x[n-2]</code> (left shift),</li>
<li>write a new value in the last index: <code>x[n-1] = newvalue</code>.</li>
</ul>

<p>This is similar to a <code>pop()</code>, <code>push(newvalue)</code> for a first-in last-out queue (only inverted).</p>

<p>A naive implementation is: <code>x[:-1] = x[1:]; x[-1] = newvalue</code>.</p>

<p>Another implementation, using <code>np.concatenate</code>, is slower: <code>np.concatenate((x[1:], np.array(newvalue).reshape(1,)), axis=0)</code>.</p>

<p>Is there a fastest way to do it?</p>
