title: Python quickly hash mutable object
body: <p>I have a bytearray that I need to use as a key to a dictionary.  Ideally I'd like to do this without doing a copy of memory the size of the bytearray.  Is there anyway to do this?
  Basically,</p>
  
  <pre><code>b = some bytearray
  d[byte(b)] = x
  </code></pre>
  
  <p>Is there any faster way to do this?  byte(b) is an O(len(bytearray)) operation which is undesirable.</p>