Python Special Colon Inquiry
<pre><code>sortedWinnerIndices = winnerIndices[-numActive:][::-1]
</code></pre>

<p>Can someone tell me what is going on here? </p>

<p><code>WinnerIndices</code> is 2048 ints long, Numpy array. I read somewhere that <code>[::-1]</code> reverses the result but I still can't figure out how this function selects a subset of winnerIndices?</p>

<pre><code>winnerIndices[-numActive:]
</code></pre>

<p>Above takes a slice from <code>-numActive</code> index to the end of the original list</p>

<pre><code>x[::-1]
</code></pre>

<p>This reverses x</p>

python numpy operator-keyword colon