property question

George Sakkis george.sakkis at gmail.com
Tue Oct 9 08:06:44 CEST 2007


On Oct 9, 1:20 am, "Manu Hack" <manuh... at gmail.com> wrote:
> hi all,
>
> If I have a class A with A.x, A.y, A.z.  A.y and A.z are property and
> in order to compute the value of them, A.y depends on A.x while A.z
> depends on A.y and A.x.  If I call A.y, and A.z, the value A.y would
> be computed twice.  Is there a smart way to avoid that as to A.y will
> be recomputed only if A.x has been changed?  Now I can define more
> variables to keep track of what is changed but when there are more
> variables and the dependency becomes more involved it could be very
> complicated.  Thanks a lot.
>
> Manu

I haven't needed to use it myself so far, but PyCells (http://
pycells.pdxcb.net/) seems it might fit the bill.

George




More information about the Python-list mailing list