Where's the documentation to support the following behavior...

grocery_stocker cdalten at gmail.com
Tue Mar 17 18:38:28 EDT 2009


On Mar 17, 3:22 pm, Emile van Sebille <em... at fenx.com> wrote:
> grocery_stocker wrote:
>
> <snip>
>
>
>
> > It seems like id(list[<some value>]) == id(<some value>).
>
> It might seem that way, but test with other than single-character
> strings, eg lists like [7],[8],[9] and try again.
>

I still get the same thing...

[cdalten at localhost ~]$ python
Python 2.4.3 (#1, Oct  1 2006, 18:00:19)
[GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a=[7]
>>> print a[0]
7
>>> id(a[0])
165911912
>>> id(7)
165911912
>>> b=[8]
>>> id(b[0])
165911900
>>> id(8)
165911900
>>> c=[9]
>>> id(c[0])
165911888
>>> id(9)
165911888
>>>





More information about the Python-list mailing list