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

2009-03-17 Thread Aahz
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

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

2009-03-17 Thread Emile van Sebille
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

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

2009-03-17 Thread andrew cooke
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

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

2009-03-17 Thread Martin v. Löwis
> 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

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

2009-03-17 Thread Gary Herron
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(

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

2009-03-17 Thread grocery_stocker
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 ~]$

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

2009-03-17 Thread Benjamin Kaplan
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

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

2009-03-17 Thread Josh Holland
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

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

2009-03-17 Thread Emile van Sebille
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

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

2009-03-17 Thread grocery_stocker
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[