Adding attributes stored in a list to a class dynamically.
steve at REMOVE-THIS-cybersource.com.au
Mon Sep 3 00:33:31 CEST 2007
On Sun, 02 Sep 2007 21:41:43 +0000, Brian Munroe wrote:
> One question though, which I haven't been able to find the answer from
> scouring the internet. What is the difference between calling
> __setattr__ and setattr or __getattr__ and getattr, for that matter?
Have you read the following?
# setattr, getattr, delattr:
# __setattr__ etc.
If there is anything unclear about the descriptions, please ask.
In a nutshell, like all double-underscore methods, __setattr__ are for
overriding behaviour in your own classes. With very few exceptions, you
shouldn't need to directly call double-underscore methods (although you
often may _write_ double-underscore methods).
More information about the Python-list