title: How can I make itemgetter to take input from list variable?
body: <p>How can I use itemgetter with list variable instead of integers?
  For example:</p>
  
  <pre><code>from operator import itemgetter
  z = ['foo', 'bar','qux','zoo']
  id = [1,3]
  </code></pre>
  
  <p>I have no problem doing this:</p>
  
  <pre><code>In [5]: itemgetter(1,3)(z)
  Out[5]: ('bar', 'zoo')
  </code></pre>
  
  <p>But it gave error when I do this:</p>
  
  <pre><code>In [7]: itemgetter(id)(z)
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-7-7ba47b19f282&gt; in &lt;module&gt;()
  ----&gt; 1 itemgetter(id)(z)
  
  TypeError: list indices must be integers, not list
  </code></pre>
  
  <p>How can I make itemgetter to take input from list variable correctly, i.e. using <code>id</code>?</p>