Message406385
The problem is that you can't use a list as the key in a dict, since dict keys need to be immutable. This means that when you try to hash an unhashable object it will result an error. For ex. when you use a list as a key in the dictionary , this cannot be done because lists can't be hashed. The standard way to solve this issue is to cast a list to a tuple . TypeError: unhashable type: 'list' usually means that you are trying to use a list as an hash argument. The standard way to solve this issue is to cast a list to tuple.
Though tuples may seem similar to lists, they are often used in different situations and for different purposes. Tuples can be used as keys if they contain only strings, numbers, or tuples; if a tuple contains any mutable object either directly or indirectly, it cannot be used as a key. You can’t use lists as key.
http://net-informations.com/python/iq/unhashable.htm |
|
Date |
User |
Action |
Args |
2021-11-16 04:54:39 | drakebohan | set | recipients:
+ drakebohan, rhettinger, sfreilich, iritkatriel |
2021-11-16 04:54:39 | drakebohan | set | messageid: <1637038479.7.0.851521769556.issue41114@roundup.psfhosted.org> |
2021-11-16 04:54:39 | drakebohan | link | issue41114 messages |
2021-11-16 04:54:39 | drakebohan | create | |
|