[EMAIL PROTECTED] writes: > Sorry folks, this is what I meant: > >>>> class heh(object): > ... def __init__(self): > ... self.foo='hello' > ... def change(self): > ... self.foo+=' world' > ... def show(self): > ... return self.foo > ... > ... class hih(object): > ... def show(self): > ... return heh().foo > ... >>>> x=heh() >>>> print x.hih().show() > hello >>>> x.change() >>>> print x.show() > hello world >>>> print x.hih().show() > hello > > I want that last one to print 'hello world'
You create a new heh in hih.show, so it's going to get the class variable. You need to use a class variable. Change the first four lines of heh to : foo = 'hello' def change(self): heh.foo = hee.foo + ' world' And that should do it. <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list