Reading the book "Introduction to computer science using Python", by Charles Dierbach, I got a question:
- In page 210, he says "A reference is a value that references, or “points to,” the location of another entity. A variable’s reference value can be determined with built-in function id."
So a reference is just the address in memory of an object.
Now, if I'm not mistaken, when I create a variable like:
>>> a = 3
The name a is put automatically by Python in the namespace.
If I do:
>>> id(a)
4548344816
I get the address in memory of the object 3, the one that a is referencing.
So what I want to know is, how are the name a and the reference value related.
I'm guessing that when a name is a put into a namespace, it includes 2 things:
The name itself.
The reference value (id of the object)
A pair like maybe: a:reference value
?
If so, is there some instrospection tool to see what an entry in the namespace look like?