title: Whats the most pythonic way to calculate percentage changes on a list of numbers
body: <p>I have a list of floating point numbers and I want to generate another list of period returns from my first list.</p>
  
  <p>This is a run of the mill implementation (not tested - and OBVIOUSLY no error checking/handling):</p>
  
  <pre><code>a = [100,105,100,95,100]
  
  def calc_period_returns(values, period):
      output = []
      startpos, endpos = (period, len(values)-1)
  
      while True:
          current = values[startpos]
          previous = values[startpos-period]
          ret = 100*((current-previous)/(1.0*previous))
          output.append(ret)
          startpos += period
          if startpos &gt; endpos:
              break
      return output
  
  
  calc_period_returns(a,1)
  
  # Expected output:
  # [5.0, -4.7619047619047619, -5.0, 5.2631578947368416]
  </code></pre>
  
  <p>Is there a more pythonic way of doing this - perhaps using list comprehension and maps?</p>