title: TypeError : Unhashable type
body: <p>I am trying to get a list of list of tuples : something like <code>[ [(1,0),(2,0),(3,0)],[(1,1),(2,1),(3,1)....]]</code>
  I used this statement </p>
  
  <pre><code>set([(a,b)for a in range(3)]for b in range(3))
  </code></pre>
  
  <p>But it gives me an error</p>
  
  <pre><code>TypeError: unhashable type: 'list'
  </code></pre>
  
  <p>I have 2 questions  for the Python Guru's:</p>
  
  <p>a) When I look at the Python definition of Hashable -</p>
  
  <blockquote>
    <p>"An object is hashable if it has a hash value which never changes during its lifetime (it needs a <strong>hash</strong>() method)"</p>
  </blockquote>
  
  <p>when I used  dir function on the expression above </p>
  
  <pre><code>dir([(a,b)for a in range(3)]for b in range(3))
  </code></pre>
  
  <p>it seems to say the <code>__hash__</code> is there. So, why do I get the error?  </p>
  
  <p>I was able to get <code>[[(0, 0), (1, 0), (2, 0)], [(0, 1), (1, 1), (2, 1)], [(0, 2), (1, 2), (2, 2)]]</code>
  by using the list command :</p>
  
  <pre><code>list(list((a,b) for a in range(3)) for bin range(3))
  </code></pre>
  
  <p>b)list and set both takes Iterable as parameter. How come one works(list) and another doesn't (set)?</p>