title: Python class attribute validation on __init__
body: <p>I'm trying to validate one attribute of my class using setter in the code below. The attribute I want to validate is called '__x' and is set to parameter passed on 'init' method. When I change 'self__x' to 'self.x', it's working as I expect. What I want to is how it's working with 'self.x', while I don't return 'x' attribute anywhere in getter and setter methods and why it's not working with 'self.__x'?</p>
  
  <pre><code>class P:
      def __init__(self, x):
          self.__x = x  # not working
          # self.x = x  # working
  
      @property
      def x(self):
          return self.__x
  
      @x.setter
      def x(self, x):
          if x &lt; 0:
              self.__x = 0
          else:
              self.__x = x
  
  
  p = P(-5)
  print(p.x)  # prints -5
  </code></pre>