Traceback (most recent call last):
  File "C:/python files/USACO/crazy/crazy.py", line 87, in <module>
    grid.plot(x,y,"F")
  File "C:/python files/USACO/crazy\grid.py", line 63, in plot
    self.g[(x,y)] = replace
TypeError: unhashable type: 'list'

You see, I'm hashing a string with the key bing a tuple.
This is using my own 2d grid data structure.

Recommended Answers

Your tuple contains probably a list

>>> D = dict()
>>> t = ([0], 1)
>>> D[t] = 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'
Jump to Post

All 3 Replies

Your tuple contains probably a list

>>> D = dict()
>>> t = ([0], 1)
>>> D[t] = 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'

THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

P.S. It was a simple mistake really, but this will come in use later.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.