reference to objects

Alex the_brain at mit.edu
Fri Oct 13 17:34:42 EDT 2000


> class Lola:
>     def __init__(x):
> 	  x.y = 0
> 
> l = Lola()
> g = l       # <-- !!
> 
> now, does g.y = 1 modify l.y ?  (do both variables refer to the same
> object ?

Yes.  Do you know about the python command line interpreter?  It's good
for trying this sort of thing out.

Alex.

-- 
Speak softly but carry a big carrot.




More information about the Python-list mailing list