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

Νίκος support at superhost.gr
Mon Jun 17 19:26:39 EDT 2013


Στις 18/6/2013 2:09 πμ, ο/η Steven D'Aprano έγραψε:
> {"a": "Hello world"}
>
> Do you see a memory location there? There is no memory location. There is
> the name, "a", and the object it is associated with, "Hello world".
> Either the dict, or the string, may move around memory if the underlying
> memory manager allows it. Obviously any object in Python must be
> *somewhere* in memory at any specific moment, but that is irrelevant to
> understanding Python code. It is no more relevant than saying that a dict
> {'a': 5} is just made up of bits.

Okey, the easy part was to understand how humans in high level need to 
understand namespaces and assignment (which is not copying but instead 
referencing another name to the same object).

But i would like to know, what happens internally within the python 
compiler, because obviously memory is involved.

The way some info(i.e. a Unicode string) is saved into the hdd , is the 
same way its being saved into the memory too? Same way exactly?

While you said to me to forget about memory locations, and that's indeed 
made things easy to follow i still keep wondering, how Python internally 
keeping tracks of 'x' and 'y' names as well as their referenced objects 
(i.e. number 6).

After all the way i understand memory is as a series of bits like:

0100010100011110101000010101010010001001010010011100001101001010010

So from the above binary form:

what is 'x', what is 'y', how's 'x' and 'y' differ from the actually 
memory locations that are bound too, and of course what is the actual value.

Its 3 things for me to consider, even in Python id internal level 
detail. I want to understand this.

names, memory addresses, memory address's actual values

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



More information about the Python-list mailing list