In article <163b0c86-adf7-434c-9270-c819c5a07...@k29g2000prf.googlegroups.com>,
grocery_stocker wrote:
>
>[cdal...@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 informati
grocery_stocker wrote:
On Mar 17, 3:22 pm, Emile van Sebille wrote:
grocery_stocker wrote:
It seems like id(list[]) == id().
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...
Well, yes -- becaus
grocery_stocker wrote:
> It seems like id(list[]) == id(). 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
> It seems like id(list[]) == id(). However, I
> can't find anything in the python documentation that talks about it.
It's deliberately undocumented (outside of the source code, that is).
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
grocery_stocker wrote:
Given the following
[cdal...@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.
list = [7,8,9]
id(list)
-1209401076
id(
On Mar 17, 3:22 pm, Emile van Sebille wrote:
> grocery_stocker wrote:
>
>
>
>
>
> > It seems like id(list[]) == id().
>
> 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...
[cdal...@localhost ~]$
On Tue, Mar 17, 2009 at 6:14 PM, grocery_stocker wrote:
> Given the following
>
> [example of cached numbers]
>
>
> It seems like id(list[]) == id(). However, I
> can't find anything in the python documentation that talks about it.
> Did I perhaps overlook something?
You didn't find anythin
On Tue, Mar 17, 2009 at 03:14:39PM -0700, grocery_stocker wrote:
> It seems like id(list[]) == id().
Only when certain immutable objects are involved. It is the
implementation's option to allow different immutable values to be the
same object (same id()). In CPython, this is used to cache strings
grocery_stocker wrote:
It seems like id(list[]) == id().
It might seem that way, but test with other than single-character
strings, eg lists like [7],[8],[9] and try again.
Emile
--
http://mail.python.org/mailman/listinfo/python-list
Given the following
[cdal...@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.
>>> list = [7,8,9]
>>> id(list)
-1209401076
>>> id(list[0])
154303848
>>> id(list[
10 matches
Mail list logo