property question

Manu Hack manuhack at gmail.com
Tue Oct 9 01:20:54 EDT 2007


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



More information about the Python-list mailing list