self-aware list of objects able to sense constituent member alterations?

koranthala koranthala at gmail.com
Wed Jan 28 12:49:37 EST 2009


On Jan 28, 10:39 pm, Reckoner <recko... at gmail.com> wrote:
> On Jan 28, 9:16 am, koranthala <koranth... at gmail.com> wrote:
>
>
>
> > On Jan 28, 5:42 pm, koranthala <koranth... at gmail.com> wrote:
>
> > > On Jan 28, 2:16 am, Reckoner <recko... at gmail.com> wrote:
>
> > > > I'm not sure this is possible, but I would like to have
> > > > a list of  objects
>
> > > > A=[a,b,c,d,...,z]
>
> > > > where,  in the midst of a lot of processing I might do something like,
>
> > > > A[0].do_something_which_changes_the_properties()
>
> > > > which alter the properties of the object 'a'.
>
> > > > The trick is that I would like A to be mysteriously aware that
> > > > something about the  object 'a' has changed so that when I revisit A,
> > > > I will know that the other items in the list need to be refreshed to
> > > > reflect the changes in A as a result of changing 'a'.
>
> > > > Even better would be to automatically percolate the subsequent changes
> > > > that resulted from altering 'a' for the rest of the items in the list.
> > > > Naturally, all of these items are related in some parent-child
> > > > fashion.
>
> > > > that might be a lot to ask, however.
>
> > > > Any advice appreciated.
>
> > > I think Python Cookbook has a recipe which deals with this.
> > > - 6.12 Checking an Instance for Any State Change.
>
> > Were you able to get this? If not, let me know. I will try to type it
> > in here - (it is a big recipe, so not doing it now)
>
> Actually, I have the python cookbook, but cannot find the recipe you
> mention. maybe I have an older version?
>
> thanks.

Mine is 2nd Edition.



More information about the Python-list mailing list