title: Iterate over all pairs of consecutive items in a list
body: <p>Given a list</p>
  
  <pre><code>l = [1, 7, 3, 5]
  </code></pre>
  
  <p>I want to iterate over all pairs of consecutive list items <code>(1,7), (7,3), (3,5)</code>, i.e.</p>
  
  <pre><code>for i in xrange(len(l) - 1):
      x = l[i]
      y = l[i + 1]
      # do something
  </code></pre>
  
  <p>I would like to do this in a more compact way, like</p>
  
  <pre><code>for x, y in someiterator(l): ...
  </code></pre>
  
  <p>Is there a way to do do this using builtin Python iterators? I'm sure the <code>itertools</code> module should have a solution, but I just can't figure it out.</p>