watching mutables?

Anton Vredegoor anton at vredegoor.doge.nl
Fri Sep 27 12:26:07 EDT 2002


On Fri, 27 Sep 2002 09:34:55 -0500, "Mark McEahern"
<marklists at mceahern.com> wrote:

>l = Watched()
>l.append(1)

Thanks for reacting to my question. However, I am looking for
something that calls a defineable function if *any* mutable variable
in the current scope changes. Variables should be 'marked' to install
this function for them. For example 'watch(m,f)' indicates that
function f is called if mutable variable m is changed. I do not want
function f to be a method of object m since I want object m to be
*any* mutable python object and furthermore I do not want to change
the orginal object. The call of function f would be triggered by *any*
change of object m. This would make debugging (and some other things I
am tinkering with) a lot easier. Is it possible?

Regards,

Anton.



More information about the Python-list mailing list