title: io.StringIO vs open() in Python 3
body: <p>All I could find is this <a href="https://docs.python.org/3/library/io.html#text-i-o" rel="noreferrer">statement</a>:</p>
  
  <blockquote>
    <p>The easiest way to create a text stream is with open(), optionally
    specifying an encoding:</p>
    
    <p><code>f = open("myfile.txt", "r", encoding="utf-8")</code></p>
    
    <p>In-memory text streams are also available as StringIO objects:</p>
    
    <p><code>f = io.StringIO("some initial text data")</code></p>
  </blockquote>
  
  <p>But this gives no insight at all on when I should use <code>open()</code> over <code>io.StringIO</code> and vice-versa. I know that they do not work exactly the same behind the scene. But why would someone go for <code>open()</code> in Python 3 ?</p>