Python internals

Ben Finney bignose+hates-spam at
Wed Jul 16 00:26:01 CEST 2008

Larry Bates <larry.bates at`> 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.

 \     “Are you pondering what I'm pondering?” “I think so, Brain, but |
  `\        I don't think Kay Ballard's in the union.” —_Pinky and The |
_o__)                                                           Brain_ |
Ben Finney

More information about the Python-list mailing list