On 9/12/2015 9:54 AM, Rustom Mody wrote:
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.
<snip>
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
https://docs.python.org/3/library/functions.html#id
id(object)
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.
Quoting from above:
>> The Free On-line Dictionary of Computing defines "pointer":
>>
>> 1. <programming> An address, from the point of view of a
>> programming language.
So, how does the CPython program access the contents given its 'address
in memory'? From the definition it would seem it's not a pointer, as
from the perspective of the programming language, you can't get there
from the id.
Look-ma,-no-pointers-ly y'rs,
Emile
--
https://mail.python.org/mailman/listinfo/python-list