title: Python mix-in enumerations as dictionary key: how the type is converted?
body: <p>Here is the code:</p>
  
  <pre><code>from enum import Enum
  
  class EFoo(str, Enum):
      A = 'e1'
      B = 'e2'
  
  print(EFoo.A)
  
  d = {
      EFoo.A : 'eA',
      EFoo.B : 'eB'
  }
  
  first_key = list(d.keys())[0]
  first_key_type = type(first_key)
  
  print("Keys: " + str(d.keys()))
  print("Type of first key: " + str(first_key_type))
  print("d[EFoo.A] = '" + d[EFoo.A] + "'")
  print("d['e1'] = '" + d['e1'] + "'")
  </code></pre>
  
  <p>Here is the output (Python 3.5)</p>
  
  <pre><code>EFoo.A  
  Keys: dict_keys([&lt;EFoo.A: 'e1'&gt;, &lt;EFoo.B: 'e2'&gt;])  
  Type of first key: &lt;enum 'EFoo'&gt;  
  d[EFoo.A] = 'eA'  
  d['e1'] = 'eA'  
  </code></pre>
  
  <p>Now the type of the dictionary keys is <code>&lt;enum 'EFoo'&gt;</code>. </p>
  
  <p>So I don't understand why the code <code>d['e1'] = 'eA'</code>, which access the dictionary by a <strong>string</strong> key, works. </p>
  
  <p>Is the string "e1" converted to an "EFoo" instance? Does Python do some reverse lookup to find the correct enum value to convert to?</p>
  
  <p>Moreover, if you remove the <code>str</code> as a parent of the class, so that the class declaration looks like <code>class EFoo(Enum):</code>, the above code snippet does not work anymore
  What does inheriting from <code>str</code> exactly do in this case?</p>