drakebohan <drakebo...@protonmail.com> added the comment:

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

----------
nosy: +drakebohan

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41114>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to