title: Why is the range object "not an iterator"?
body: <p>I wrote this and expected <code>0</code>:</p>
  
  <pre><code>&gt;&gt;&gt; x = range(20)
  &gt;&gt;&gt; next(x)
  </code></pre>
  
  <p>Instead I got:</p>
  
  <blockquote>
    <p>TypeError: 'range' object is not an iterator</p>
  </blockquote>
  
  <p>But I thought it was a generator?</p>
  
  <p>The initial answer yielded the same thing I initially said to myself: it's an iterable, not an interator. But then, that wouldn't explain why this works, if both are simply generators:</p>
  
  <pre><code>&gt;&gt;&gt; x = (i for i in range(30))
  &gt;&gt;&gt; next(x)
  0
  </code></pre>