On 6/17/2013 7:34 AM, Simpleton wrote:
On 17/6/2013 9:51 πμ, Steven D'Aprano wrote:
Now, in languages like Python, Ruby, Java, and many others, there is no
table of memory addresses. Instead, there is a namespace, which is an
association between some name and some value:
global namespace:
x --> 23
y --> "hello world"
First of all thanks for the excellent and detailed explanation Steven.
As for namespace:
a = 5
1. a is associated to some memory location
2. the latter holds value 5
This is backwards. If the interpreter puts 5 in a *permanent* 'memory
location' (which is not required by the language!), then it can
associate 'a' with 5 by associating it with the memory location. CPython
does this, but some other computer implementations do not.
So 'a', is a reference to that memory location, so its more like a name
to that memory location, yes? Instead of accessing a memory address with
a use of an integer like "14858485995" we use 'a' instead.
So is it safe to say that in Python a == &a ? (& stands for memory address)
is the above correct?
When you interpret Python code, do you put data in locations with
integer addresses?
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list