Using class data attributes

Craig Findlay craigf at ilid.com.au
Wed Feb 9 21:58:18 EST 2000


I would like to be able to read and write data attributes as in Delphi
and automatically invoke functions.

eg if I have instantiated a class called fred, which has an attribute
x

Then when I do a read of x:
y = fred.x
I want to fred to invoke a function that returns x but can do
something else (some preprocessing of x perhaps) as well.

Likewise if I do a write to x:
fred.x = y

Then I want to invoke a function that can process y in some way before
changing x.

For those who may know Delphi, this is like the Delphi property
operators "read" and "write"

Can I do this ir at least simulate my desired behaviour.

Thanks, Craig Findlay
Melbourne Australia



More information about the Python-list mailing list