[PEAK] Using peak.model as an observer subject

Phillip J. Eby pje at telecommunity.com
Thu Sep 2 01:17:50 EDT 2004


At 11:06 PM 9/1/04 -0500, Doug Quale wrote:
>"Phillip J. Eby" <pje at telecommunity.com> writes:
>
> > At 09:48 PM 9/1/04 -0500, Doug Quale wrote:
> > >"Phillip J. Eby" <pje at telecommunity.com> writes:
> > >
> > > > At 09:11 PM 9/1/04 -0500, Doug Quale wrote:
> > > >
> > > > >I have a Python 101 type question:  What is the advantage of using
> > > > >key = feature.attrName+'__event' instead of key = '__event'?
> > > >
> > > > To have an event object for each feature.
> > >
> > >But doesn't each feature already have a separate __dict__?
> >
> > It does, but that's not the one we're using.  If we did, callbacks
> > would be issued when that feature was changed on *any* object, not
> > just the one we registered on.
>
>OK, I hadn't considered the possibility that feature objects could be
>shared by different objects.  How would that happen, and under what
>circumstances would we want to do it?

They're *always* shared; they live in the class as descriptors, not in 
individual instances.




More information about the PEAK mailing list