On 06/17/2013 08:50 AM, Simpleton wrote:
On 17/6/2013 2:58 μμ, Michael Torrie wrote:
a = 5
b = a
a <---> memory address
b <---> memory address
I like to think a and b as references to the same memory address
Not quite: a and b _are_ memory addresses, At the same time, a and b are references to the
data (the objects) stored in those memory locations.
The distinction is probably more important in languages like C/C++, where the _language_ gives
you direct access to, and can manipulate, these memory addresses (through pointers). Python
handles it differently and does not give you this sort of ability, it all occurs "under the
hood". Yes, the id() function will tell you the addresses, but you can't do anything with them
other than perhaps compare them. It's really pretty much useless information.
--
http://mail.python.org/mailman/listinfo/python-list