[docs] Possible bug in Python documentation
santoso.wijaya at gmail.com
Sun Mar 6 00:51:39 CET 2011
You are confusing "names" (variables) and "objects".
In the first, `a=20`, the "name" `a` is bound to the "object" `20`.
In the second, `a=22`, the "name" `a` is re-bound to another "object", `22`.
Regardless, the "identity" of either "objects"--`20` and `22`--never
On Sat, Mar 5, 2011 at 9:15 AM, Mark Ballard <markjballard at googlemail.com>wrote:
> I'm having a lot of fun reading your excellent Python documentation.
> 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:
> The documentation says:
> "An object’s identity never changes once it has been created"
> 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.
> 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:
> >>> a=20
> >>> id(a)
> >>> a=22
> >>> id(a)
> I hope this is of some help.
> Best regards
> docs mailing list
> docs at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the docs