Detect when a class member is updated

Steve Holden sholden at
Wed Jan 15 15:42:49 CET 2003

"Boethius" <boethius at> wrote in message
news:67446a0a.0301150634.f6d0c43 at
> Can I detect when a class member is added or updated?
> I have a class with a member called path. Everytime it's updated, I'd
> like to run a 'sanity check' on the new value.
> How can I do this?

Take a look at "setattr()" generally, and the __setattr__() special method
inparticular. This allows you to trap access to attributes.

Steve Holden                        
Python Web Programming       
Bring your musical instrument to PyCon!

More information about the Python-list mailing list