Terminology: "reference" versus "pointer"

rurpy at yahoo.com rurpy at yahoo.com
Sun Sep 13 02:44:33 CEST 2015


On 09/12/2015 06:02 PM, Ned Batchelder wrote:
> On Saturday, September 12, 2015 at 7:15:18 PM UTC-4, Mark Lawrence wrote:
> [...]
> But in C, pointers mean more than that.  You can perform arithmetic on
> them, to access memory as a linearly addressed abstraction.  Python has
> nothing like this.
> 
> In C, a pointer can refer to another variable.  Again, Python has
> nothing like this.  Python names refer to values, but they cannot
> refer to other names.
> 
> These last two reasons are why people say that Python does not have
> pointers.
> 
> As a language concept, Python has no pointers, because you cannot have
> names referring to names, and because you cannot perform arithmetic on
> references.  The references from names to values are not things that can
> be manipulated themselves.

The reason python doesn't have pointers is that the majority of developers
and documenters chose not to use the term.

I don't see that pointer arithmetic is necessary to call something a pointer
(and i think someone else said the same earlier). And references to a name
I think that is an artifact of C because in C names and values are inextricably
welded together at compile time -- a pointer to a name is also necessarily a
pointer to a value. Since there are no C pointers to don't point to values
they can provide a way to describe Python "things" that also point to values.

If one acknowledges that those two properties are not intrinsic requirements
for pointerness then describing the things "in" a python object that are used
to identify and dereference other objects, as pointers is not at all unreasonable.



More information about the Python-list mailing list