Classes in python, how to set an attributes
<p>When I write class in python, most of the time, I am eager to set variables I use, as properties of the object. Is there any rule or general guidelines about which variables should be used as class/instance attribute and which should not?</p>

<p>for example:</p>

<pre><code>class simple(object):
    def __init(self):
        a=2
        b=3
        return a*b

class simple(object):
    def __init(self):
        self.a=2
        self.b=3
        return a*b
</code></pre>

<p>While I completely understand the attributes should be a property of the object. This is simple to understand when the class declaration is simple but as the program goes longer and longer and there are many places where the data exchange between various modules should be done, I get confused on where I should use a/b or self.a/self.b. Is there any guidelines for this?</p>
