On Mon, 20 Apr 2009 18:18:39 +0100, dasacc22 <[email protected]> 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. Doing as you said fixed my
problem, heres the code as reference for w/e
class Widget(object):
_children = None
_parent = None
def __init__(self, parent=None):
self.children = []
self.parent = parent
@property
def children(self):
return self._children
@children.setter
def children(self, obj):
self._children = obj
@property
def parent(self):
return self._parent
@parent.setter
def parent(self, obj):
if obj:
print obj
obj.children.append(self)
self._parent = obj
1. Please don't top-post, it really doesn't help legibility.
2. This is an artist's impression of a photograph of a greek translation
of your code. I wouldn't use it as a reference for anything except how
to terminally confuse yourself.
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list