Is it better to use class variables or pass parameters?

Mc Osten riko at despammed.com
Wed Mar 1 20:37:55 CET 2006


On 1 Mar 2006 11:32:02 -0800, Derek Basch wrote:

> This one has always bugged me. Is it better to just slap a "self" in
> front of any variable that will be used by more than one class method
> or should I pass around variable between the methods?

I think there is no clear "general" answer. A criterion could be that
instance variables should be those who define the state of the object, that
define its "meaning".

About the others to me it's a matter of taste.

-- 
USB Priests for only 10$



More information about the Python-list mailing list