title: What value do I use in a slicing range to include the last value in a numpy array?
body: <p>Imagine some numpy array, e.g. <code>x = np.linspace(1,10)</code>.</p>
  <p><code>x[i:j]</code> gives me a view into <code>x</code> for the range <code>[i,j)</code>.
  I love that I can also do <code>x[i:-k]</code> which excludes the last <code>k</code> elements.</p>
  <p>However, in order to include the last element I need to do <code>x[i:]</code>.</p>
  <p>My question is this: How do I combine these two notations if I for instance need to loop over <code>k</code>.</p>
  <p>Say that I want to do this:</p>
  <pre><code>l = list()
  for k in [5,4,3,2,1]:
      l.append(x[:-k])
  l.append(x[:])
  </code></pre>
  <p>What annoys me is that last line. In this simple example of course it doesn't do much of a difference, but sometimes this becomes much more annoying. What I miss is something more DRY-like.</p>
  <p>The following snippet course does NOT yield the desired result, but represents the style of code I seek:</p>
  <pre><code>l = list()
  for k in [5,4,3,2,1,0]:
      l.append(x[:-k])
  </code></pre>