title: Python string FIFO
body: <p>Does Python have any data types for FIFO buffering of strings?  I created something (below) but suspect I'm reinventing the wheel.</p>
  
  <pre><code>class Buffer(list):
      def __init__(self):
          super(Buffer, self).__init__()
  
      def put(self, nlmsg):
          for c in nlmsg: self.append(c)
  
      def peek(self, number):
          return "".join( [self[i] for i in range(number)] )
  
      def get(self, number):
          return "".join( [self.pop(0) for i in range(number)] )
  </code></pre>
  
  <p>Usage example:</p>
  
  <pre><code>&gt;&gt;&gt; buf = Buffer()
  &gt;&gt;&gt; buf.put('abcdefg')
  &gt;&gt;&gt; buf
  ['a', 'b', 'c', 'd', 'e', 'f', 'g']
  &gt;&gt;&gt; buf.peek(4)
  'abcd'
  &gt;&gt;&gt; buf
  ['a', 'b', 'c', 'd', 'e', 'f', 'g']
  &gt;&gt;&gt; buf.get(5)
  'abcde'
  &gt;&gt;&gt; buf
  ['f', 'g']
  </code></pre>
  
  <p>I looked at <code>Queue</code> but when adding a str I would have to split each byte manually, else the entire str would become an item in the queue.  Is there anything like this already out there?</p>