0
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.

2
Contributors
3
Replies
6
Views
4 Years
Discussion Span
Last Post by james.lu.75491856
0

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'
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.