Python: Cyclic indexing of lists
<p>Take the following example : </p>

<pre><code>a = range(10)  
</code></pre>

<p>We can proceed through the list from left to right as follows: <code>a[0], a[1], ...., a[9]</code>
Or in the other way around with negative indexes: <code>a[-1], a[-2], a[-3], ....</code></p>

<p>It is also possible to index a range, e.g. <code>a[from:to-1]</code></p>

<p>Because I know that the index of the last element is -1, I would say (theoretical thought) that <code>a[0:0]</code> should deliver the whole list, since <code>a[0:0-1]</code> is from 0 to -1 (including -1). </p>

<p>This is wrong, but why? It makes more sense to me than <code>a[0:]</code> (whole list)
EDIT:</p>

<p>So to make it simple (I'm just wondering!^^):
<code>a[from:to-1]</code> means: get elements from <code>from</code> to <code>to</code>. Ok, we want to get the whole list, means (following this reasoning): <code>a[0:0]</code> (which is the empty list), but hey 0-1 is the last element, right?</p>
