Terminology: "reference" versus "pointer"
rustompmody at gmail.com
Sun Sep 13 01:39:48 CEST 2015
On Sunday, September 13, 2015 at 4:05:21 AM UTC+5:30, ru... at yahoo.com wrote:
> On 09/12/2015 04:14 PM, Emile van Sebille wrote:
> > On 9/12/2015 12:58 PM, rurpy--- via Python-list wrote:
> >> The question is whether what "pointer" means in languages that use the
> >> word is*so* different than its meaning in the Python sense
> > I can't find a single reference to pointer in the python docs outside
> > of ctypes. What is its python sense?
> I should have said "proposed sense" (except I don't really mean
> proposed as in "let's change all the docs" but as "let's stop the
> hissy-fits when someone uses the term"), i.e. the way I, I think
> random832, and others use it re python. Sorry, I see in retrospect
> my phrasing could be confusing.
Here is my post a little way up:
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.
which may be summarized as:
1. Steven (quoting Online dictionary): Pointer = Address
2. Steven: "Python has pointers" is ridiculous
3. Python docs: id returns an address in (C)Python
To which we have Chris saying CPython ≠ Python
Which reminds me of another definition
Fig-Leaf: A device for converting poor porn into high art
Even in languages like C with an ISO standard adhering to the standard is
academic (gcc's switch is --pedantic) and it is in practice major
implementations like gcc and MSC that define and push the standard.
In python, CPython is the standard and other implementations can lay claim to
being 'python' to the extent that they adhere to the standard.
Or have I missed some ISO-ization?
More information about the Python-list