<div>You are confusing "names" (variables) and "objects".</div><div>In the first, `a=20`, the "name" `a` is bound to the "object" `20`.</div><div>In the second, `a=22`, the "name" `a` is re-bound to another "object", `22`.</div>
<div><br></div><div>Regardless, the "identity" of either "objects"--`20` and `22`--never changes.</div><div><br clear="all"></div>~/santa<br>
<br><br><div class="gmail_quote">On Sat, Mar 5, 2011 at 9:15 AM, Mark Ballard <span dir="ltr"><<a href="mailto:markjballard@googlemail.com">markjballard@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>Hello<br clear="all"></div><div><br></div><div>I'm having a lot of fun reading your excellent Python documentation.</div><div><br></div><div>I have found a discrepancy that may be attributable to my ignorance, but is possibly an error, in the section of the documentation dealing with Objects, Values and Types:</div>
<div><br></div><div><a href="http://docs.python.org/reference/datamodel.html#index-820" target="_blank">http://docs.python.org/reference/datamodel.html#index-820</a><br></div><div><br></div><div>The documentation says:</div>
<div><br></div>
<div>"An object’s identity never changes once it has been created"</div><div><br></div><div>While using the interpreter to illustrate the points in the documentation, it appeared to me that an object's identity does change with its value.</div>
<div><br></div><div>This, for example, is copied from my interpreter and appears to show that the id of the object a does change when I change its value:</div><div><br></div><div>>>> a=20<br></div><div><br></div>
<div>>>> id(a)<br></div><div>137972908<br></div><div><br></div><div>>>> a=22<br></div><div><br></div><div>>>> id(a)<br>137972884<br><br></div><div>I hope this is of some help.</div><div><br></div>
<div>Best regards</div><div><br></div><font color="#888888"><div>Mark.</div>
</font><br>_______________________________________________<br>
docs mailing list<br>
<a href="mailto:docs@python.org">docs@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/docs" target="_blank">http://mail.python.org/mailman/listinfo/docs</a><br>
<br></blockquote></div><br>