title: python class attribute
body: <p>i have a question about class attribute in python.</p>
  <pre><code>class base :
      def __init__ (self):
          pass
      derived_val = 1
  
  t1 = base()
  t2 = base()
  
  t2.derived_val +=1
  t2.__class__.derived_val +=2
  print t2.derived_val             # its value is 2
  print t2.__class__.derived_val   # its value is 3
  </code></pre>
  <p>The results are different. I also use <code>id()</code> function to find <code>t2.derived_val</code> and <code>t2.__class__.derived_val</code> have different memory address.
  My problem is <code>derived_val</code> is class attribute. Why it is different in above example?
  Is it because the instance of class copy its own <code>derived_val</code> beside the class attribute?</p>