Terminology: "reference" versus "pointer"

Chris Angelico rosuav at gmail.com
Sat Sep 12 13:06:28 EDT 2015


On Sun, Sep 13, 2015 at 2:54 AM, Rustom Mody <rustompmody at gmail.com> wrote:
>> 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.

*Python* does not have addresses. *CPython* is an implementation of
the Python language which uses memory. Jython uses Java objects, and
thus doesn't have memory addresses. PyPy doesn't keep things at fixed
locations in memory, and maintains a separate concept of object
identities, even though it is implemented using some form of system
memory.

Python does not have pointers or addresses.

ChrisA



More information about the Python-list mailing list