__parent__ - like attribute?

Andrew Bennetts andrew-pythonlist at puzzling.org
Sun Jan 19 17:13:11 EST 2003


On Sun, Jan 19, 2003 at 08:15:45AM -0800, Dylan Reinhardt wrote:
> At 03:41 AM 1/19/2003, Bengt Richter wrote:
> 
> >   class Egg:
> >        def __init__(self, my_container):
> >            self.my_container = my_container
> 
> 
> This is actually what I'm doing now.  If this is the best available answer, 
> I can certainly live with that, but it been surprised at what some of the 
> namespace wizards here have come up with in the past, so I thought I'd see 
> if there is a more elegant/efficient answer.

Judging from what you've said earlier, the most elegant way to solve your
specific problem would be to have both Egg and Spam inherit from Persistent,
and let them both manage their own _p_changed flags.  Then there is no need
to pass parent references around, or other namespace tricks -- ZODB will
take care of it for you.

Is there some reason you can't do this?

-Andrew.






More information about the Python-list mailing list