title: Custom property setter / getter in Python
body: <p>I do have a class "Contact" where I get all fields from one contact in a customer database. The property keys are not dynamic; the can be hard-coded.
  Two access the properties, I need customer getter and setter; getters do format the output, e.g. date formatting, currency,... setters as well, e.g. when you set a datetime if converts into UNIX timestamp for the database.</p>
  
  <p>Also, I need these properties to be available for auto-complete in my IDE, don't like to write property names manually as I typically screw them up with typos. So I think they either need to be an attribute or a function.</p>
  
  <p>The solution I found but which is lots of lines of code:</p>
  
  <pre><code>class Contact(Dict):
  
      def __init__(self, values: Dict = {}):
          self.values = values
  
      get_email(self):
          return self.values('email')
  
      set_email(self, value):
          self.values['email'] = value
  
      get_create_date(self):
          d = self.values.get('create_date', None)
          if d:
              return d.strftime('%Y-%m-%d')
          else:
              return None
  
      set_create_date(self, value):
          self.values['create_date'] = value
  
      get_price(self):
          p = self.values.get('price', None)
          if d:
              return "{:,}.-".format(p)
          else:
              return None
  </code></pre>