title: Data Hiding in Python Class
body: <p>I know that the attributes of class which are declared by double underscore <code>__</code> prefix may or may not visible outside the class definition. As we can still access those attributes by <code>object._className__attrName</code>.</p>
  
  <pre><code>class A:
      def __init__(self):
          self.a = 1
          self.b = 2
          ----
          ----
          self.z = 26
          self.catch = 100
  </code></pre>
  
  <p>Now to protect all attributes except the attribute <code>catch</code>, I have to declare them with double underscore which is quite messy. Is there a way I can say in my class definition that only <code>self.catch</code> can be accessed outside the class?</p>
  
  <p>Apologies if this is answered somewhere else or discussed earlier.</p>