title: Understanding the difference between `self`and `cls` and whether they refer to the same attributes
body: <p>I'm trying to understand if there are differences between <code>self</code> and <code>cls</code> but I'm struggling, even though a lot of discussion on this topic exists. For instance:</p>
  
  <pre><code>class maclass():
      A = "class method"
  
      def __init__(self):
          self.B = "instance method"
  
      def getA_s(self):
          print(self.A)
  
      def getA_c(cls):
          print(cls.A)
  
      def getB_s(self):
          print(self.B)
  
      def getB_c(cls):
          print(cls.B)
  
  C = maclass()
  C.getA_s()
  C.getA_c()
  C.getB_s()
  C.getB_c()
  </code></pre>
  
  <p>which give me:</p>
  
  <pre><code>class method
  class method
  instance method
  instance method
  </code></pre>
  
  <p>So whether I use <code>self</code> or <code>cls</code>, it always refers to the same variable. When I add a <code>self.A</code> in the <code>Init__</code>, the cls.A is just replaced</p>
  
  <pre><code>def __init__(self):
          self.B = "instance method"
          self.A = "new instance method"
  </code></pre>
  
  <p>and I get:</p>
  
  <pre><code>new instance method
  new instance method
  instance method
  instance method
  </code></pre>
  
  <p>I don't understand the point of having two ways to call a class member if they are the same? I know this is a common question on this forum, yet I really don't understand why we would use different words to refer to the same thing (we even could use any variable name instead of <code>self</code> or <code>cls</code>).</p>
  
  <h2>update</h2>
  
  <p>In the following case:</p>
  
  <pre><code>class maclass():
      A = "class method, "
  
      def __init__(self):
          self.A = "instance method, "
  
      def getA_s(self):
          print(self.A) #give me "instance method, "
  
      @classmethod
      def getA_c(cls):
          print(cls.A) #give me "class method, "
  
  C = maclass()
  C.getA_s()
  C.getA_c()
  print(' ')
  print(C.A) #give me "instance method, "
  </code></pre>
  
  <p>I get :</p>
  
  <pre><code>instance method, 
  class method, 
  
  instance method,    
  </code></pre>
  
  <p>So in this case, in <code>maclass</code>: <code>cls.A</code> and <code>self.A</code> do not refer to the same variable.</p>