title: Class variable Vs. Instance variable in python for int value
body: <p>I am new to python and i am not sure how this is working. Code is as below:</p>
  
  <pre><code>class test():
      d=0
      def __init__(self):
         self.d=self.d+1;
  
  D=test()
  print D.d
  D1=test()
  print D1.d
  D2=test()
  print D2.d
  </code></pre>
  
  <p>Output is </p>
  
  <pre><code>1,1,1  # This should not be
  </code></pre>
  
  <p>Now using this :</p>
  
  <pre><code>class test():
      d=[]
      def __init__(self):
         self.d.apend("1");
  
   D=test()
   print D.d
   D1=test()
   print D1.d
   D2=test()
   print D2.d
  </code></pre>
  
  <p>Result is (This should be)</p>
  
  <pre><code>['1']
  ['1', '1']
  ['1', '1', '1']
  </code></pre>
  
  <p>So i am not sure why integer value is not being treated as class variable while list is being treated.</p>