title: Python - How to quickly pull several attributes from an object?
body: <p>I have a proprietary <code>job</code> object that has several non-method string attributes that I would like to be able to compile into a list efficiently. The <code>job</code> object has an attribute <code>TAGS</code> that includes the full list of attribute names that I would like to compile the values for, but has no method for pulling just the values. I'm looking for a way to leverage the <code>TAGS</code> list to efficiently pull all the needed string attributes.</p>
  
  <pre><code>&gt;&gt;&gt; job_object.TAGS
  ('date', 'id', 'name', 'state', 'starttime', 'endtime', 'runs', ...) # There are 9 in all
  </code></pre>
  
  <p>I can pull the attributes individually, but I would like to have an efficient implementation and would rather not hard code just in case the <code>TAGS</code> changes.</p>
  
  <pre><code>&gt;&gt;&gt; job_object.id
  '1426013702'
  </code></pre>
  
  <p>I've tried using <code>exec</code> but it, of course, doesn't return anything.</p>
  
  <pre><code>&gt;&gt;&gt; [exec('job_object.{}'.format(tag)) for tag in job_object.TAGS]
  [None, None, None, None, None, None, None, None, None, None, None, None, None]
  </code></pre>
  
  <p>Is there another way to pull these without call each attribute explicitly?</p>