Best way to set/get an object property
hubaghdadi at gmail.com
Sun Aug 24 12:07:47 CEST 2008
I noted that Python encourage the usage of:
obj.prop = data
x = obj.prop
to set/get an object's property value.
What if I want to run some logic upon setting/getting a property?
What is Python preferred method to do so (using the new feature
I don't think __getattr__ and __setattr__ are practical (I have to
code the property name into them).
More information about the Python-list