title: efficient circular buffer?
body: <p>I want to create an efficient <a href="http://en.wikipedia.org/wiki/Circular_buffer">circular buffer</a> in python (with the goal of taking averages of the integer values in the buffer).</p>
  
  <p>Is this an efficient way to use a list to collect values?</p>
  
  <pre><code>def add_to_buffer( self, num ):
      self.mylist.pop( 0 )
      self.mylist.append( num )
  </code></pre>
  
  <p>What would be more efficient (and why)?</p>