Where's the documentation to support the following behavior...
andrew cooke
andrew at acooke.org
Tue Mar 17 20:10:30 EDT 2009
grocery_stocker wrote:
> It seems like id(list[<some value>]) == id(<some value>). However, I
> can't find anything in the python documentation that talks about it.
> Did I perhaps overlook something?
most of your examples stated the obvious (that if x is in a list l at
index i then id(list[i]) == id(x) - this is because list[i] is x). but
that is not what you state above in words (and which is wrong).
the only non-trivial thing in your post is that two different instances of
(an object representing) the same value have the same id, and that is due
to implementation specific caching.
but i am worried you think you have seen something that you have not,
especially given your incorrect text above.
andrew
More information about the Python-list
mailing list