Python internals

Larry Bates larry.bates at websafe.com`
Tue Jul 15 19:39:53 EDT 2008


Ben Finney wrote:
> Larry Bates <larry.bates at websafe.com`> writes:
> 
>> Names are pointers in Python that point to values in memory.
> 
> The term "pointer" carries much extra baggage for a programmer
> thinking of C (as the original poster is). Python names give no access
> to the "address" of the value, and don't need to be "de-referenced".
> 
> I've had better success explaining Python names to such people in
> terms of "references": there is no "address" and no "de-reference"
> needed. Access the name, and you get its value.
> 
> On the other hand, I prefer to avoid using either of those concepts,
> and talk in terms of "name tags" or "sticky notes". Names (and other
> references, like list elements) attach to the object, and have no
> other value or purpose. They don't affect the object they're attached
> to; they are entirely independent of other bindings to the same
> object; they re-bind to another object with no history of what they
> were bound to previously.
> 
> The analogy is quite robust, and carries none of the confusing baggage
> of "variable" or "pointer" or other overloaded language terms.
> 

You are, of course, correct.  Since I'm not a C programmer, the term pointer 
doesn't carry the same "baggage" as it might to others.  The "problem" I had 
when I first started is that people were using such "vague" terms like names, 
tags, etc. that it had no meaning to me.  I like your idea of "references".

-Larry




More information about the Python-list mailing list