Append to each dictionary within a list
<p>I have a list of dictionary objects:</p>

<pre><code>[{u'ID': 46757,
  u'currentenddate': u'09/30/2016',
  u'name': u'Project A',
  u'projstartdate': u'05/01/2016'},
 {u'ID': 46625,
  u'currentenddate': u'07/15/2016',
  u'name': u'Project B',
  u'projstartdate': u'05/02/2016'},
 {u'ID': 47100,
  u'currentenddate': u'08/02/2016',
  u'name': u'Project C',
  u'projstartdate': u'06/01/2016'}]
</code></pre>

<p>and I would like to append to ALL dictionary items a new field <code>client_id</code>, resulting in:</p>

<pre><code>[{u'ID': 46757,
  u'currentenddate': u'09/30/2016',
  u'name': u'Project A',
  u'projstartdate': u'05/01/2016'},
  u'client_id': u'12398'},
 {u'ID': 46625,
  u'currentenddate': u'07/15/2016',
  u'name': u'Project B',
  u'projstartdate': u'05/02/2016'},
  u'client_id': u'12398'},
 {u'ID': 47100,
  u'currentenddate': u'08/02/2016',
  u'name': u'Project C',
  u'projstartdate': u'06/01/2016'}
  u'client_id': u'12398'}]
</code></pre>

<p><code>client_id</code> will remain the same for all dictionary items.  I know I can achieve the outcome using a <code>for</code> loop coupled with <code>dict['client_id'] = id</code> but the code is no longer vectorized.  Is there a pythonic way to append to each dict item within the list?</p>

<hr>

<p><strong>UPDATE:</strong></p>

<p>Thanks for the lively conversation about list comprehensions versus <code>for</code> loops.  I'll test both methods and use the faster of the two for my situation.  Also, going forward, I'll explicitly define what I mean by 'vectorized' and 'pythonic' in my questions, so we're all on the same page (thanks, @Adam Smith).</p>

<p>A <strong>Python 3.5</strong> solution showcasing the new dict <em>unpacking</em>. </p>

<pre><code>[{**dict_element, **{u'client_id':u'12398'}} for dict_element in your_list]
</code></pre>

<p>Check <a href="https://www.python.org/dev/peps/pep-0448/" rel="nofollow">this</a>.</p>

<p><strong>Demo</strong></p>

<pre><code>&gt;&gt;&gt; your_list = [{u'ID': 46757,
...   u'currentenddate': u'09/30/2016',
...   u'name': u'Project A',
...   u'projstartdate': u'05/01/2016'},
...  {u'ID': 46625,
...   u'currentenddate': u'07/15/2016',
...   u'name': u'Project B',
...   u'projstartdate': u'05/02/2016'},
...  {u'ID': 47100,
...   u'currentenddate': u'08/02/2016',
...   u'name': u'Project C',
...   u'projstartdate': u'06/01/2016'}]
&gt;&gt;&gt; 
&gt;&gt;&gt; from pprint import pprint
&gt;&gt;&gt; pprint([{**dict_element, **{u'client_id':u'12398'}} for dict_element in your_list])
[{'ID': 46757,
  'client_id': '12398',
  'currentenddate': '09/30/2016',
  'name': 'Project A',
  'projstartdate': '05/01/2016'},
 {'ID': 46625,
  'client_id': '12398',
  'currentenddate': '07/15/2016',
  'name': 'Project B',
  'projstartdate': '05/02/2016'},
 {'ID': 47100,
  'client_id': '12398',
  'currentenddate': '08/02/2016',
  'name': 'Project C',
  'projstartdate': '06/01/2016'}]
</code></pre>

python list dictionary