title: Setup element getter for dictionaries
body: <p>This works, according to the <a href="https://docs.python.org/3/library/operator.html#operator.itemgetter" rel="nofollow noreferrer">documentation</a>:</p>
  
  <pre><code>&gt;&gt;&gt; inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)]
  &gt;&gt;&gt; list(map(operator.itemgetter(1), inventory))
  [3, 2, 5, 1]
  </code></pre>
  
  <p>Now I want to do something similar, for a list of dicts:</p>
  
  <pre><code>&gt;&gt;&gt; data = [{'xxx': 'x'}, {'xxx': 'y'}]
  &gt;&gt;&gt; list(map(operator.attrgetter('xxx'), data))
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  AttributeError: 'dict' object has no attribute 'xxx'
  </code></pre>
  
  <p>I was expecting:</p>
  
  <pre><code>['x', 'y']
  </code></pre>
  
  <p>But it seems <code>attrgetter</code> does not work for dictionaries (only for classes?). How can I setup an "element getter" for dictionaries?</p>