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

Joel Goldstick joel.goldstick at gmail.com
Mon Jun 17 12:26:38 EDT 2013


On Mon, Jun 17, 2013 at 11:55 AM, Simpleton <support at superhost.gr> wrote:

> 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!
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>


Read and study this.  Then come back and ask again.  Don't think of
physical representation of memory with actual binary addresses.  Python is
not assembler.  Neither is it C (sometimes called high level assembler)
http://docs.python.org/2/tutorial/classes.html#python-scopes-and-namespaces

-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130617/53071027/attachment.html>


More information about the Python-list mailing list