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:
http://www.python.org/doc/lib/built-in-funcs.html

# __setattr__ etc.
http://www.python.org/doc/ref/attribute-access.html

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).



-- 
Steven.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to