title: How do I revert sys.stdout.close()?
body: <p>In the interactive console:</p>
  
  <pre><code>&gt;&gt;&gt; import sys
  &gt;&gt;&gt; sys.stdout
  &lt;open file '&lt;stdout&gt;', mode 'w' at 0xb7810078&gt;
  &gt;&gt;&gt; sys.stdout.close()
  &gt;&gt;&gt; sys.stdout # confirming that it's closed
  (...) ValueError: I/O operation on closed file
  </code></pre>
  
  <p>Attempting to revert:</p>
  
  <pre><code>&gt;&gt;&gt; sys.stdout.open()
  (...) AttributeError: 'file' object has no attribute 'open'
  &gt;&gt;&gt; sys.stdout.write('foo')
  (...) ValueError: I/O operation on closed file
  </code></pre>
  
  <p>I agree that it's a frivolous question, but I'm curious how sys.stdout.close() can be reverted in Python (without restarting the interactive console, of course) and why sys.stdout.open() does not make sense.</p>