title: Dynamically set self.x from a dictionary key/value pair
body: <p>I have a slice of code where I want to transform thirty or forty ever-changing key/value pairs into variables under a class. So for instance:</p>
  
  <pre><code>for i in dict:
      self.i = dict[i]
  </code></pre>
  
  <p>But of course that would just reset self.i each time. I've tried eval, but you cannot set variables with it, as it reports 'x=1' as invalid syntax. I've tried searching, but I'm not even quite sure what to search...</p>
  
  <p>Thanks!</p>