Detect when a class member is updated

Peter Hansen peter at engcorp.com
Wed Jan 15 12:29:56 EST 2003


Boethius wrote:
> 
> 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?

Minor nit-picking on the terminology: you probably mean you
have an *object* (an instance of a class) with a "member"
(or attribute) which you want to sanity check.

Note that classes are also objects in Python, and those too
can be updated on-the-fly, but you don't appear to want to
do that.

-Peter




More information about the Python-list mailing list