list storing variables
Marko Rauhamaa
marko at pacujo.net
Tue Feb 24 03:18:22 EST 2015
Steven D'Aprano <steve+comp.lang.python at pearwood.info>:
> Ben Finney wrote:
>> There is no “address of a value” concept in Python.
>
> Furthermore, in Python, values can *change their address*.
>
> Jython and IronPython both are built on top of a garbage collector
> which can move memory around, meaning that objects can end up in a
> completely different location. This makes no difference to Python
> code, and there is no supported way of getting to the address of an
> object. (In fact, objects may be split over multiple locations, even
> in CPython, e.g. the new optimized implementation for dicts has shared
> storage for keys.)
You are taking the concept of "address" far too literally, and yet not
literally enough.
Even in C programs, the *physical* address of a variable/value can
change at any point without warning.
In abstract terms, an address is a reference. And that reference stays
still in both C and Python. What happens under the hood of the data
model is irrelevant.
Marko
More information about the Python-list
mailing list