title: Python on Raspberry Pi user input inside infinite loop misses inputs when hit with many
body: <p>I have a very basic <em>parrot</em> script written in Python that simply prompts for a user input and prints it back inside an infinite loop. The Raspberry Pi has a USB barcode scanner attached for the input.</p>
  
  <pre><code>while True:
      barcode = raw_input("Scan barcode: ")
      print "Barcode scanned: " + barcode
  </code></pre>
  
  <p>When you scan at a "normal" speed it works reliably and the command output looks like this:</p>
  
  <pre><code>Scan barcode: 9780465031467
  Barcode scanned: 9780465031467
  Scan barcode: 9780007505142
  Barcode scanned: 9780007505142
  </code></pre>
  
  <p>But when you really hammer it with many scans in close succession it is possible to make it miss inputs and the command output looks like this:</p>
  
  <pre><code>Scan barcode: 9780141049113
  Barcode scanned: 9780141049113
  Scan barcode: 9780465031467
  Barcode scanned: 9780465031467
  Scan barcode: 9780007505142
  9780571273188
  Barcode scanned: 9780571273188
  </code></pre>
  
  <p>Notice how <code>9780007505142</code> was input but never printed back. It got <em>lost</em> in the confusion.</p>
  
  <p>See a video demonstration of my test at: <a href="https://youtu.be/kdsfdKFhC1M" rel="noreferrer">https://youtu.be/kdsfdKFhC1M</a>  </p>
  
  <p>My question: <strong>Is this an inevitability of using a low powered device like a Pi? Will it always be true that a user with a barcode scanner will be able to <em>out-run</em> the hardware's ability to keep up?</strong> </p>