title: Python 2.7: Is it good practice to set all args/kwargs attribute with setattr?
body: <p>In <a href="https://stackoverflow.com/questions/2466191/set-attributes-from-dictionary-in-python">this</a> answer it is shown how to automatically set as attribute the kwargs/args passed to a class <code>__init__</code></p>
  
  <p>For example, one could do:</p>
  
  <pre><code>class Employee(object):
      def __init__(self, *initial_data, **kwargs):
          # EDIT
          self._allowed_attrs = ['name', 'surname', 'salary', 'address', 'phone', 'mail']
  
          for dictionary in initial_data:
              for key in dictionary:   
                  if key in self._allowed_attrs:  # EDIT
                      setattr(self, key, dictionary[key])
          for key in kwargs:
              if key in self._allowed_attrs:  # EDIT
                  setattr(self, key, kwargs[key])
  </code></pre>
  
  <p>In my case I already know in advance the arguments I am going to pass, so I am considering this solution only to have a less repetitive and shorter code.</p>
  
  <p>Is this considered good practice?
  Which are the pro/cons of this solutions against manually initialise each attribute? Is there any other preferable approach?</p>
  
  <p><strong>EDIT:</strong> As the first comments/answers (rightly) focus on sanitizing arguments or listing arguments, I think this can be solved quite easily in this framework.</p>