title: Automatically setting getter, setter and deleter in python
body: <p>Ok I've been reading about using the <a href="http://docs.python.org/2/library/functions.html#property">@property</a> decorator in Python rather than specific methods for getting, setting and deleting. Some example code is shown below.</p>
  
  <pre><code>class Person(object):
  
      def __init__(self):
  
          self._firstName = None
          self._lastName = None
          self._age = None
  
      @property
      def firstName(self): return self._firstName
      @firstName.setter
      def firstName(self, val): self._firstName = val
      @firstName.deleter
      def firstName(self): del self._firstName
  
      @property
      def lastName(self): return self._lastName
      @lastName.setter
      def lastName(self, val): self._lastName = val
      @lastName.deleter
      def lastName(self): del self._lastName
  
      @property
      def age(self): return self._age
      @age.setter
      def age(self, val): self._age = val
      @age.deleter
      def age(self): del self._age
  
  Peter = Person()
  
  Peter.firstName = 'Peter'
  Peter.lastName = 'Smith'
  Peter.age = 21
  
  print ' '.join([Peter.firstName, Peter.lastName])
  </code></pre>
  
  <p>As you can see, the majority of the code in the example is devoted to defining the methods. </p>
  
  <p>My question is whether there is a way to automatically assign the getter, setter and deleter for each of my variables? In my actual code I have a lot more variables and it seems like a lot of repetitive code setting each method.</p>
  
  <p>I realise that for simple cases it may not strictly be necessary however I'd prefer to code the methods in now in case I ever decide to increase the complexity of the class.</p>