Python: two objects are the same
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/8463907/assignment-of-objects-and-fundamental-types">Assignment of objects and fundamental types</a>  </p>
</blockquote>



<pre><code>a = [1,2,3]
b = a
print b is a
</code></pre>

<p>This code prints True. Why? "is" only returns True if the two variables point to the same object, when in this case they're different objects with the same value. "==" would return True, but "is" shouldn't.</p>

<p>However, since</p>

<pre><code>b.reverse()
print a,b
</code></pre>

<p>prints [3, 2, 1] [3, 2, 1], it seems that as far as the interpreter is concerned, they ARE the same object, and operations on b will automatically be performed on a. Again, why? I've never seen anything like this happen before.</p>
