Actually I hollered "D'oh!" immediately after posting that, just then
noticing that I had proudly shown off one of the classic Python
beginner errors. The easy correction:

class Context(object):
    def __init__(self):
        self.__name__ = None
        self.__parent__ = None
        self.children = {}
    [...]

-- Wade



On Jan 26, 5:21 pm, Rob Miller <r...@kalistra.com> wrote:

> > class Context(object):
>
> >      __name__ = None
> >      __parent__ = None
> >      children = {}
>
> >      def __getitem__(self, name):
> >          return self.children[name]
>
> >      def add_child(self, child, name):
> >          child.__name__ = name
> >          child.__parent__ = self
> >          self.children[name] = child
>
> maybe you omitted code for brevity, but you don't really want `children`
> to be defined at the class level, do you?  i.e. you have an
> __init__(self) method that sets `self.children = {}`, either here or in
> all of the base classes right?  otherwise all of your instances are
> sharing the same children:

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to