Terminology: "reference" versus "pointer"
rustompmody at gmail.com
Sat Sep 12 18:54:24 CEST 2015
On Saturday, September 12, 2015 at 10:02:40 PM UTC+5:30, Steven D'Aprano wrote:
> On Sat, 12 Sep 2015 02:42 pm, Random832 wrote:
> > Anyway, maybe we do need a term to distinguish Python/C#/Java pointers
> > from C/C++ pointers - maybe call it a "non-arithmetic" pointer, since
> > the key thing about it is you can't do pointer arithmetic on them to get
> > the object "next to" the one it points at.
> How about *just don't call them pointers*? You know, since they aren't
> pointers in the computer science sense.
> The Free On-line Dictionary of Computing defines "pointer":
> 1. <programming> An address, from the point of view of a
> programming language. A pointer may be typed, with its type
> indicating the type of data to which it points.
> Insisting that Python has pointers is like insisting that you use a text
> editor by flipping bits. "What happens if I press Ctrl-X?" "Well, these
> bits on the screen flip from black to white, these bits flip from white to
> black, and these stay the same."
This is from the docs
Return the "identity" of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value.
CPython implementation detail: This is the address of the object in memory.
More information about the Python-list