pointer

Oleg Broytmann phd at phd.pp.ru
Tue Apr 9 10:56:48 EDT 2002


On Tue, Apr 09, 2002 at 04:45:08PM +0200, Henning Peters wrote:
> is there anything similar to the pointer concept from c/c++ in python?

   In Python *everything* is a pointer. Really.

> i would like to store values in two different locations. both values should
> always be equal. the one could be a pointer on the other. is this possible
> to do this in python?

a = 1 # put a pointer to an Integer objetc into variable a
b = a # copy the pointer into b; now both b and a hold pointers to the same
      # Integer object

c = [a, b] # make a list holding two pointers

etc...

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list