Re: [Tutor] How to replace instances

2008-09-29 Thread Kent Johnson
Replying to the list.. On Mon, Sep 29, 2008 at 12:43 AM, Steve Collins <[EMAIL PROTECTED]> wrote: > Sorry it took me so long to respond; I haven't been able to afford any time > to such leisurely pursuits as programming. > I'm not cc'ing this to the Mailing list, becuase I fear it may get a little

Re: [Tutor] How to replace instances

2008-09-26 Thread Richard Lovely
Hi, I'm not going to guess at why this doesn't work, but I've got a potential solution for you: class Z(object): def __init__(self,y): self.y = y def replaceZ (self,withWhat): self.__dict__ = withWhat.__dict__ Is there a reason you can't use a simple assignment (x=y) outsi

Re: [Tutor] How to replace instances

2008-09-25 Thread Kent Johnson
On Thu, Sep 25, 2008 at 8:03 AM, Steve Collins <[EMAIL PROTECTED]> wrote: > that's what I was trying (incorrectly) to achieve the above example. > but how can I do this for an arbitrary number of objects in a list? > > I have a list x = [a,b,c] and a list y = [d,e,f], both filled with > instance o

Re: [Tutor] How to replace instances

2008-09-25 Thread Steve Collins
On 9/25/08, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Thu, Sep 25, 2008 at 4:24 AM, Steve Collins <[EMAIL PROTECTED]> > wrote: > >> However, some of the instances refer explicitly to other instances >> instances. It's obvious why this causes problems. It occurred to me to >> simply replace the i

Re: [Tutor] How to replace instances

2008-09-25 Thread Kent Johnson
On Thu, Sep 25, 2008 at 4:24 AM, Steve Collins <[EMAIL PROTECTED]> wrote: > However, some of the instances refer explicitly to other instances > instances. It's obvious why this causes problems. It occurred to me to > simply replace the instances with the ones in the un-pickled list, but I > don't