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

Michael Torrie torriem at gmail.com
Mon Jun 17 07:58:41 EDT 2013


On 06/17/2013 05:34 AM, Simpleton wrote:
> So is it safe to say that in Python a == &a ? (& stands for memory address)
> 
> is the above correct?

It might be partially equivalent inside the interpreter, but it's not
something you should concern yourself with.  And in general, no it's not
safe to say, since Python is a reference-counted, garbage-collected
object system and pointers in C certainly are not.

> I say this because here you said that: Instead, there is a namespace, 
> which is anassociation between some name and some value:
> 
> When you say that you mean that a is associated to some value as in 
> memory location or to that memory location's address?

In python just think of assignment as making a name *be* an object.  And
if you assign one name to another name, that makes both names be the
same object.  When names are unbound (either they go out of scope or you
manually unbind them), the objects they are bound to are garbage collected.

Forget about the details of how the interpreter might doing at a low level.



More information about the Python-list mailing list