Using class data attributes
skip at mojam.com
Thu Feb 10 04:24:54 CET 2000
Craig> I would like to be able to read and write data attributes as in
Craig> Delphi and automatically invoke functions.
Take a look at the special methods __getattr__ and __setattr__. They should
provide the hooks you need to accomplish what you want. For details, check
the reference manual section on customizing attribute access:
__getattr__ is only called if normal attribute lookup
fails. If defined, __setattr__ is always called, even if the attribute in
question already exists.
Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/
"Languages that change by catering to the tastes of non-users tend not to do
so well." - Doug Landauer
More information about the Python-list