Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

Simpleton support at superhost.gr
Mon Jun 17 11:55:37 EDT 2013


On 17/6/2013 5:22 μμ, Terry Reedy wrote:
> 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.

Please tell me how do i need to understand the sentence
'a' is being associated with number 5 in detail.

Why don't we access the desired value we want to, by referencing to that 
value's memory location directly instead of using namespaces wich is an 
indirect call?

i feel we have 3 things here

a , memory address of a stored value, actual stored value

>> 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?

I lost you here.


-- 
What is now proved was at first only imagined!



More information about the Python-list mailing list