title: Inherit from Dict with Private Values on Object
body: <p><strong>EDIT - I Figured it out</strong></p>
  
  <p>So I have the class as defined below:</p>
  
  <pre><code>class BaseLocation(dict):
      _ao = None
      _op = None
  
      def __init__(self, iterable=None):
          if iterable is None:
              iterable = {}
          self.update(iterable)
      def __setattr__(self, key, value):
          """sets the attribute"""
          if key.startswith("_"):
              setattr(self, key, value)
          else:
              dict.__setitem__(self, key, value)
      def __setattribute__ (self, key, value):
          super(BaseGeometry, self).__setattribute__(key, value)
      def __setitem__(self, key, value):
          dict.__setitem__(self, key, value)
  
      def __getattribute__ (self, name):
          return super(BaseGeometry, self).__getattribute__(name)
  
      def __getattr__(self, name): # support item attributes
          try:
              return dict.__getitem__(self, name)
          except:
              raise AttributeError("'%s' object has no attribute '%s'" % (type(self).__name__, name))
  
      def __getitem__(self, k): 
          return dict.__getitem__(self, k)
  </code></pre>
  
  <p>The dictionary returned does not show the "_" values, which is fine.  I want these attributes to be private and not seen by the user.  My question is this, is how do I set these values?  If I do BaseLocation._ao = (1,0) and I print the BaseLocation object, I see <code>_ao</code> in the dictionary, which I never want to see.  So what do I need to do to hide this variable?</p>
  
  <pre><code>bl = BaseLocation({'x':1,'y':10})
  bl._ao = 1
  print(bl)
  </code></pre>
  
  <p>You will see <code>_ao</code> appears in the dict of the object.</p>