title: Disable output buffering
body: <p>Is output buffering enabled by default in Python's interpreter for <code>sys.stdout</code>?</p>
  
  <p>If the answer is positive, what are all the ways to disable it?</p>
  
  <p>Suggestions so far:</p>
  
  <ol>
  <li>Use the <code>-u</code> command line switch</li>
  <li>Wrap <code>sys.stdout</code> in an object that flushes after every write</li>
  <li>Set <code>PYTHONUNBUFFERED</code> env var</li>
  <li><code>sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)</code></li>
  </ol>
  
  <p>Is there any other way to set some global flag in <code>sys</code>/<code>sys.stdout</code> programmatically during execution?</p>