On Nov 27, 2007, at Nov 27:1:21 PM, hdante wrote:

 This shouldn't confuse a C programmer if he understands that
assignment changes the pointer address, instead of copying the value:


Coming from C, I found the pointer analogy to work pretty well, but in my head I always felt that integers (or other numbers) were somehow different than lists, dicts and other classes. I think I found it a little weird to think that --> 1 <-- is an object. "You can't have all the integers as individual objects!", is what I thought...then I saw that is exactly how it is implemented. So when you say:

a=1

it is *really* a pointer to a 1-object, and that

b=1  points to the same 1-object.

In [4]:id(a)
Out[4]:25180552

In [5]:b=1

In [6]:id(b)
Out[6]:25180552


                                                bb


--
Brian Blais
[EMAIL PROTECTED]
http://web.bryant.edu/~bblais



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to