How to get the actual address of a object

mujunshan at gmail.com mujunshan at gmail.com
Fri Oct 24 00:51:02 EDT 2008


Hi,I have a strange idea:is there any way to get  memory address of a
object.

      For example:

                 i = 10

                 addr = get_address(i)
    address will be assigned a integer which is pointer of object
i,then I want to recast addr into another integer:

                 j = cast(addr,<type int>)

I think it is easy to get it by modifying source code of  python,but I
would like to know if there was an existing one.

many thanks



More information about the Python-list mailing list