title: Opening already opened file does not raise exception
body: <p>Consider those two python programs:</p>
  
  <p><code>script_a.py</code>:</p>
  
  <pre><code>from datetime import datetime
  from time import sleep
  
  while True:
      sleep(1)
      with open('foo.txt', 'w') as f:
          sleep(3)
          s = str(datetime.now())
          f.write(s)
          sleep(3)
  </code></pre>
  
  <p><code>script_b.py</code>:</p>
  
  <pre><code>while True:
      with open('foo.txt') as f:
          s = f.read()
          print s
  </code></pre>
  
  <p>Run <code>script_a.py</code>. While it is running, start <code>script_b.py</code>. Both will happily run, but <code>script_b.py</code> outputs an empty string if the file is currently opened by <code>script_a.py</code>.</p>
  
  <p>I was expecting an <code>IOError</code> exception to be raised, telling me the file is already opened, but it didn't happen, instead the file looks empty. Why is that and what would be the proper way to check if it is opened by another process? Would it be ok to simply check if an empty string is returned and try again until something else is read, or is there a more pythonic way?</p>