title: Mixing file.readline() and file.next()
body: <p>I noticed some strange behavior today playing around with <code>next()</code> and <code>readline()</code>.  It seems that both functions produce the same results (which is what I expect).  However, when I mix them, I get a <code>ValueError</code>. Here's what I did:</p>
  
  <pre><code>&gt;&gt;&gt; f = open("text.txt", 'r')
  &gt;&gt;&gt; f.readline()
  'line 0\n'
  &gt;&gt;&gt; f.readline()
  'line 1\n'
  &gt;&gt;&gt; f.readline()
  'line 2\n'
  &gt;&gt;&gt; f.next()
  'line 3\n'
  &gt;&gt;&gt; f.next()
  'line 4\n'
  &gt;&gt;&gt; f.readline()
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ValueError: Mixing iteration and read methods would lose data
  &gt;&gt;&gt;
  &gt;&gt;&gt; f = open("text.txt", 'r')
  &gt;&gt;&gt; f.next()
  'line 0\n'
  &gt;&gt;&gt; f.next()
  'line 1\n'
  &gt;&gt;&gt; f.next()
  'line 2\n'
  &gt;&gt;&gt; f.readline()
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ValueError: Mixing iteration and read methods would lose data
  </code></pre>
  
  <p>So the overall question here is <strong>what's going on underneath the hood that causes this error?</strong></p>
  
  <p>Some questions that might get answered along with but I would like to hear an answer for if not:</p>
  
  <ol>
  <li>What are the differences between <code>next()</code> and <code>readline()</code>?</li>
  <li>When I do <code>for f in file:</code> which function am I calling (and does it matter)?</li>
  <li>Why can I call <code>next()</code> after <code>readline()</code>, but not the other way around?</li>
  </ol>
  
  <p>Thanks in advance,</p>
  
  <p>I don't think it matters, but in case this is version dependent, I'm on Python 2.7.6 for Windows</p>