title: Open a file in memory
body: <p>(I'm working on a Python 3.4 project.)</p>
  
  <p>There's a way to open a (sqlite3) database in memory :</p>
  
  <pre><code>    with sqlite3.connect(":memory:") as database:
  </code></pre>
  
  <p>Does such a trick exist for the open() function ? Something like :</p>
  
  <pre><code>   with open(":file_in_memory:") as myfile:
  </code></pre>
  
  <p>The idea is to speed up some test functions opening/reading/writing some short files on disk; is there a way to be sure that these operations occur in memory ?</p>