title: bytes vs bytearray in Python 2.6 and 3
body: <p>I'm experimenting with <code>bytes</code> vs <code>bytearray</code> in Python 2.6. I don't understand the reason for some differences.</p>
  
  <p>A <code>bytes</code> iterator returns strings:</p>
  
  <pre><code>for i in bytes(b"hi"):
      print(type(i))
  </code></pre>
  
  <p>Gives:</p>
  
  <pre><code>&lt;type 'str'&gt;
  &lt;type 'str'&gt;
  </code></pre>
  
  <p>But a <code>bytearray</code> iterator returns <code>int</code>s:</p>
  
  <pre><code>for i in bytearray(b"hi"):
      print(type(i))
  </code></pre>
  
  <p>Gives:</p>
  
  <pre><code>&lt;type 'int'&gt;
  &lt;type 'int'&gt;
  </code></pre>
  
  <p>Why the difference?</p>
  
  <p>I'd like to write code that will translate well into Python 3. So, is the situation the same in Python 3?</p>