O
Ori Berger
I *think* I saw a post some time ago enabling "spreadsheet" like
computations, that allows something along the lines of:
1000
(Not sure what the actual syntax definitions were)
And vars.b was only re-computed if vars.a was changed -
otherwise a cached value was returned.
I can write this myself, but the solution I'm thinking of is
inelegant, and I remember the solution was extremely short and
elegant; I can't find anything in the google archives, though.
Anyone perhaps have a link or other helpful info?
(My idea of how to do it: make vars a special dict that logs
every __get__, and that can have callbacks when something is
__set__. the dependency() code would evaluate the expression,
see what __get__s were logged, and attach the same expression to
be reevaluated when any of those were __set__.
It becomes complicated, though, if I wish to track changes to
vars.subvar1.subvar2.subvar3 as well, though).
computations, that allows something along the lines of:
1000
(Not sure what the actual syntax definitions were)
And vars.b was only re-computed if vars.a was changed -
otherwise a cached value was returned.
I can write this myself, but the solution I'm thinking of is
inelegant, and I remember the solution was extremely short and
elegant; I can't find anything in the google archives, though.
Anyone perhaps have a link or other helpful info?
(My idea of how to do it: make vars a special dict that logs
every __get__, and that can have callbacks when something is
__set__. the dependency() code would evaluate the expression,
see what __get__s were logged, and attach the same expression to
be reevaluated when any of those were __set__.
It becomes complicated, though, if I wish to track changes to
vars.subvar1.subvar2.subvar3 as well, though).