title: Unable to use a tuple as a dictionary key?
body: <p>The code is a little complex, sorry. Please focus on the <code>parallel_p</code> function. Although <code>sign</code> is a tuple, Python complains:</p>
  
  <p><code>if sign in hashtable</code> and gives a <code>TypeError</code>. Why is <code>sign</code> a <code>numpy.ndarray</code> rather than a tuple? I created it as a tuple.</p>
  
  <pre><code>p_dist = dict()
  
  def parallel_prog(hashtable):
      def wrapper(func):
          if parallel_programming:
              @wraps(func)
              def parallel_p(*args, **kwargs):
                  sign = tuple(args) 
                  print type(sign)
                  if sign in hashtable:
                      r = hashtable[sign] # hit.
                      return r
                  r = func(*args, **kwargs)
                  hashtable[tuple(sign)] = r # register for future hits.
                  return r
              return parallel_p
          else:
              return func
      return wrapper
  
  
  @parallel_prog(p_dist)
  def euclidean(a, b, signature=None):
  
      val = np.sqrt(np.add.reduce((a - b)**2))
      return val
  </code></pre>
  
  <h3>IN TEST MODULE</h3>
  
  <pre><code>class similartyTest(unittest.TestCase):
  
      def setUp(self):
          self.t = np.array([1,2,3,4])
          self.t1 = np.array([0, 0, 0, 0])
          self.t2 = np.array([4,3,2,1])
          self.h1 = [1,0,0,1,1]
          self.h2 = [1,1,1,1,1]
  
      def test_euclidean(self):
          self.failUnless(euclidean(self.t, self.t) == 0)
          self.failUnless(euclidean(self.t, self.t1) == sqrt(30))
  </code></pre>
  
  <h3>OUTPUT:</h3>
  
  <pre><code>&lt;type 'tuple'&gt;`
  
  TypeError: unhashable type: 'numpy.ndarray`
  </code></pre>