Wanting to fire an event when property content changes
marduk at letterboxes.org
Tue Mar 3 20:54:44 CET 2009
On Tue, 2009-03-03 at 13:41 -0600, nuwandame wrote:
> What I am wanting to do is execute code whenever a property of a class
> object has been changed.
> 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
> 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?
Use Python properties:
More information about the Python-list