title: Weird file seeking behaviour
body: <p>With respect to two interactions below, I'd expect the same file output by both, but the second one writes at the end of the file. The only difference is a read statement AFTER the write, I don't understand what's happening. What am I missing?</p>
  
  <p>Expected behavior:</p>
  
  <pre><code>&gt;&gt;&gt; f = open("test.txt","w+")
  &gt;&gt;&gt; f.write('0123456789')
  10
  &gt;&gt;&gt; f.seek(0)
  0
  &gt;&gt;&gt; f.read(3)
  '012'
  &gt;&gt;&gt; f.seek(0,1)
  3
  &gt;&gt;&gt; f.write('XX')
  2
  &gt;&gt;&gt; f.seek(0)
  0
  &gt;&gt;&gt; f.read()
  '012XX56789'
  &gt;&gt;&gt; f.close()
  </code></pre>
  
  <p>Unexpected behavior:</p>
  
  <pre><code>&gt;&gt;&gt; f = open("test.txt","w+")
  &gt;&gt;&gt; f.write('0123456789')
  10
  &gt;&gt;&gt; f.seek(0)
  0
  &gt;&gt;&gt; f.read(3)
  '012'
  &gt;&gt;&gt; f.seek(0,1)
  3
  &gt;&gt;&gt; f.write('XX')
  2
  &gt;&gt;&gt; f.read(2)
  '34'
  &gt;&gt;&gt; f.seek(0)
  0
  &gt;&gt;&gt; f.read()
  '0123456789XX'
  &gt;&gt;&gt; f.close()
  </code></pre>
  
  <p>As you can see <code>XX</code> was written <strong>after</strong> the whole line, while I was at position 3 when writing these characters.</p>