Is there some way to call a function each-time the value of a variable changes, in python?
Something like a listener, perhaps?
Specifically, I'm referring to the case where only the variable is shared between scripts like a GAE-Session. (Which uses Cookies, Memcache, etc to share data)
Example: ScriptA & ScriptB, share a session variable. When Script B changes it, SctiptA has to call a method to handle that change.
Use properties. Only mutable values can change to begin with.
This package may be helpful.
You Probably need extend type "int" or "float", and override the function "setattr", make it to response in your own way.
If the variable is a class attribute, you may define
__setattr__
in the class.For this case (And I can't believe im saying the words) sounds like situation for setters