Thanks to all who responded. I see my biggest mistake was not spotting the assignment of 'self' being local to the method - very dumb indeed, especially as I have seen this many times before.
However I am glad I was not necessarily dumb to want to do what I was thinking of. I am learning lots! Thanks > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Alan Gauld > Sent: 12 January 2005 20:13 > To: Alan Gauld; Barnaby Scott; 'Tutor' > Subject: Re: [Tutor] class instance with identity crisis > > > Whoops, I forgot to do an assignment... > > > So try > > > > def dry(self): return Prune() > > > > > class Prune: > > > def __str__(self): > > > return 'prune' > > > > > > weapon = Damson() > > > weapon.dry() > > weapon = weapon.dry() > > > > print weapon > > > > Should work as expected... > > Alan G > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor