title: asynchronous progress spinner
body: <p>This is the code for the progress spinner: </p>
  
  <pre><code>import sys
  import time
  
  def spinning_cursor():
      while True:
          for cursor in '|/-\\':
              yield cursor
  
  spinner = spinning_cursor()
  for _ in range(50):
      sys.stdout.write(spinner.next())
      sys.stdout.flush()
      time.sleep(10)
      sys.stdout.write('\b')
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>python2.7 test.py
  |
  </code></pre>
  
  <p>It is spinning very slowly since the loop sleeps for 10 seconds...</p>
  
  <p>How do I keep rotating the spinner while the process is sleeping?</p>