Wanting to fire an event when property content changes

nuwandame nuwandame at hotmail.com
Tue Mar 3 14:41:34 EST 2009


What I am wanting to do is execute code whenever a property of a class
object has been changed.

i.e.

class test:

    testproperty = None


bob = test()
bob.testproperty = 'something'

So, when bob.testproperty is set to a new value I can run code that
changes other dependent yet loosly tied properties in containing class
objects.

I have looked at using metaclass for this but havn't found anything for
property attributes, just methods...

Anyone have ideas how this can be done?

Nu



More information about the Python-list mailing list