title: Python sliding windows of a list
body: <p>Is there an efficient or elegant way to retrieve all the k-size sublists of a list in Python? For example:</p>
  <pre><code>arr = [2, 3, 5, 7, 11, 13]
  </code></pre>
  <p>I want all 3-element sublists:</p>
  <pre><code>result = [[2, 3, 5],
            [3, 5, 7],
            [5, 7, 11],
            [7, 11, 13]]
  </code></pre>
  <p>I know I could create this with a for loop, slicing the list with <code>arr[i:i+3]</code>, but the lists I'm dealing with are gigantic and I'm hoping for an efficient mechanism, or at least an elegant or Pythonic mechanism.</p>
  <p>I'm using Pandas as well, so happy to use a Pandas mechanism.</p>