Re: getter and setter and list appends

2009-04-24 Thread Piet van Oostrum
> dasacc22 (d) wrote: >d> The property method of parent and children actually calls a >d> _set_as_parent() and _set_as_child() method after setting the private >d> variable to pack the object for display purposes so that children can >d> be detached from the parent (becoming its own parent) a

Re: getter and setter and list appends

2009-04-24 Thread dasacc22
On Apr 24, 4:04 am, Piet van Oostrum wrote: > > dasacc22 (d) wrote: > >d> Ah thank you for clarifying, I did confuse instance and class > >d> attributes from creating the list in the class def. I actually just > >d> spiffed up that class to represent a portion of a much larger class > >d> tha

Re: getter and setter and list appends

2009-04-24 Thread Piet van Oostrum
> dasacc22 (d) wrote: >d> Ah thank you for clarifying, I did confuse instance and class >d> attributes from creating the list in the class def. I actually just >d> spiffed up that class to represent a portion of a much larger class >d> that needs getter and setter for children. Doing as you s

Re: getter and setter and list appends

2009-04-20 Thread Rhodri James
On Mon, 20 Apr 2009 18:18:39 +0100, dasacc22 wrote: Ah thank you for clarifying, I did confuse instance and class attributes from creating the list in the class def. I actually just spiffed up that class to represent a portion of a much larger class that needs getter and setter for children. Do

Re: getter and setter and list appends

2009-04-20 Thread Terry Reedy
dasacc22 wrote: Hi, I seem to be having a problem with a list being share across multiple instantiations of it and dont quite understand why this is happening. Class attributes are shared by all instances. My class looks like this, class Widget(object): _parent = None _children = []

Re: getter and setter and list appends

2009-04-20 Thread dasacc22
Ah thank you for clarifying, I did confuse instance and class attributes from creating the list in the class def. I actually just spiffed up that class to represent a portion of a much larger class that needs getter and setter for children. Doing as you said fixed my problem, heres the code as refe

Re: getter and setter and list appends

2009-04-20 Thread Diez B. Roggisch
dasacc22 wrote: > Hi, > > I seem to be having a problem with a list being share across multiple > instantiations of it and dont quite understand why this is happening. > > My class looks like this, > > class Widget(object): > _parent = None > _children = [] > > def __init__(self, p

getter and setter and list appends

2009-04-20 Thread dasacc22
Hi, I seem to be having a problem with a list being share across multiple instantiations of it and dont quite understand why this is happening. My class looks like this, class Widget(object): _parent = None _children = [] def __init__(self, parent=None): self.parent = parent