forcing a definition to be called on attribute change
fredrik at pythonware.com
Tue Oct 24 05:52:23 EDT 2006
Michael Malinowski wrote:
> Apologies if this is a stupidly obvious or simple question. If I have a
> class with a series of attributes, is there a way to run a function
> definition in the class whenever a specific attribute is changed?
you can implement a __setattr__ hook, or, in Python 2.2 and newer, use
note that "setter" properties only work if you inherit from "object".
More information about the Python-list