title: python numpy array / dict multiple inheritance
body: <p>I was wondering if there was an easy way to create a class to handle both integer and keyword indexing of a numpy array of numbers.</p>
  
  <p>The end goal is to have a numpy array that I can also index using the names of each variable.
  For example, if I have the lists</p>
  
  <pre><code>import numpy as np
  a = [0,1,2,3,4]
  names = ['name0','name1','name2','name3','name4']
  A = np.array(a)
  </code></pre>
  
  <p>I would like to be able to get the values of A easily with a call of (for example) A['name1'], yet have the array retain all of the functionality of a numpy array.</p>
  
  <p>Thanks!</p>
  
  <p>Peter</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Thanks so much for the help, I'll try to be more clear on the intended use! I have an existing set of code which uses a numpy array to store and apply a vector of variables. My vector has around 30 entries.</p>
  
  <p>When I want to see the value of a particular variable, or when I want to make a change to one of them, I have to remember which entry corresponds to which variable (the order or number of entries doesn't necessarily change once the array is created). Right now I use a dictionary to keep track. For example, I have a numpy array 'VarVector' with with 30 values. "vmax" is entry 15, with a value of 0.432. I'll then have a concurrent dictionary with 30 keys 'VarDict', such that VarDict[entry] = index. This way I can find the value of vmax by chaining the calls</p>
  
  <p>VarVector[VarDict["vmax"]]</p>
  
  <p>which would return 0.432</p>
  
  <p>I was wondering if there would be a good way of simply combining these two structures, such that both VarVector[15] (for compatibility) and VarVector["vmax"] (for convenience to me) would point to the same number.</p>
  
  <p>Thanks!
  Peter</p>