title: modify setattr to mass-assign multiple attributes to different values
body: <p>I was trying to make a class that can assign multiple attributes to different values at one go. So, I tried to modify the setattr to do this.</p>
  
  <pre><code>class hello():
      def __setattr__(self,attr,value):
          if type(attr) == str:
              self.__dict__[attr] = value
          elif type(attr) == list:
              for item,val in zip(attr,value):
                  self.__dict__[item] = val
          else:
              print "Error!!!"
  </code></pre>
  
  <p>so that my desired class would have the property:</p>
  
  <pre><code>&gt;&gt;&gt; hola = hello()
  &gt;&gt;&gt; setattr(hola,["a","b"],[1,2])
  &gt;&gt;&gt; hola.a
  1
  &gt;&gt;&gt; hola.b
  2
  </code></pre>
  
  <p>But doing this returns</p>
  
  <pre><code>TypeError: attribute name must be string, not 'list'
  </code></pre>
  
  <p>It is true that I can define a special method inside the class for this job, like</p>
  
  <pre><code>def assigner(self, attrlist, valuelist):
      for item,value in zip(attrlist,valuelist):
          self.__dict__[item] = value
  </code></pre>
  
  <p>But wanted to know why it is not possible via setattr and most efficient way to do this job</p>