Terminology: “reference” versus “pointer”
steve at pearwood.info
Sat Sep 12 18:50:53 CEST 2015
On Sat, 12 Sep 2015 03:03 pm, Random832 wrote:
> Yes I am. You're just making the implicit assumption that a "value" has
> to be a number, and I was ignoring that assumption. The value is the
> address of an object.
The unknown, unknowable, and in fact possibly non-existent address of an
object. There is nothing about the Python language which demands that
objects have addresses. We could build a Python interpreter using a giant
clockwork mechanical computing machine, like the Difference Engine only
much more complex, and it would not have addressable objects.
If you would prefer a more practical counter-example, we can simulate a
Python interpreter in our head (at least for short programs). Again, there
is no addressable memory in the human brain, and hence the objects have no
But for the sake of the argument, let's suppose you are right, and that
Python values are "the address of the object".
x = "blue cats eat green mice"
I would say that the value of x is the string "blue cats eat green mice".
You, apparently, believe that the value of x is 0xb7aea480. Or possibly
0xb43384aa. Or whatever address the interpreter happens to give you on this
specific run of your program.
This abuse of the word "value" is sheer balderdash. To quote Fredrik Lundh:
well, I guess you can, in theory, value an artificial number
assigned to an object as much as the object itself.
"Joe, I think our son might be lost in the woods"
"Don't worry, I have his social security number"
Python values are not addresses. Python values are objects. Addresses, even
when they exist, are not accessible in the Python language.
More information about the Python-list