Peter Otten wrote: >> something like this didn't work for me: <snip> > But this will, I suppose: > > @property > def ancestors(self): > if self.parent: > return self.parent.ancestors + [self.parent] > return [] > > A non-recursive variant: > > @property > def ancestors(self): > result = [] > node = self.parent > while node: > result.append(node) > node = node.parent > result.reverse() > return result
Indeed, both of these patterns suit my needs. Thanks very much for the eye-opening insights. Jeffrey -- http://mail.python.org/mailman/listinfo/python-list