class variable vs instance variable --Python
<p>I tried this below example and need some clarification..In both the cases, I'm able to access the class variable and instance in test function.</p>

<p>So, assume if I have to define a literal that needs to be used across all function, which would be the better way to define..self variable or class variable?</p>

<p>code.py</p>

<pre><code>class testclass:
    classvar = 'its classvariable LITERAL'
    def __init__(self,x,y):
        self.z = x
        self.classvar = 'its initvariable LITERAL'

        self.test()

    def test(self):
        print('class var',testclass.classvar)
        print('instance var',self.classvar)

if __name__ == '__main__':
    x = testclass(2,3)
</code></pre>
