title: General setter for a class using strings
body: <p>Let's say I have a class called &quot;Employee&quot; which was a bunch of different attributes. I can create a general getter which would basically get every attribute based on a string of its name like this but I don't know how to create a setter of the sort so I wouldn't have to do something like <code>employee1.age = 22</code> every time. And creating multiple setter for every attribute would be pretty messy.</p>
  <pre><code>class Employee:
  
      def __init__(self, name, age):
          self.name = name
          self.age = age
          self.address = &quot;Somewhere&quot;
          self.job = None
  
      def getter(self, name):
          return getattr(self, name, None)
  
      def setter(self, name, amount):
          pass
  </code></pre>