Is it possible to get the Physical memory address of a variable in python?

MRAB python at
Tue Nov 10 02:44:57 CET 2009

Ognjen Bezanov wrote:
> Hello all,
> Say I have a python variable:
> a = "hello"
> Is it possible for me to get the physical address of that variable (i.e. 
> where it is in RAM)?
> I know that id(a) will give me it's memory address, but the address 
> given does not seem to correlate with the physical memory. Is this even 
> possible?
Python doesn't have variables as such. The variable's name is just a key
in a dict and the variable's value is the corresponding value for that
key (or, to be exact, a reference to the value). A particular value can
be referred to by any number of 'variables'.

More information about the Python-list mailing list