+ 2

What does unhashable type mean?

26th Aug 2016, 9:08 AM
Shokoofeh Parvin
Shokoofeh Parvin - avatar
2 Answers
+ 3
This means that you cannot use a variable storing a list or dictionary when declaring a dictionary. Example: alist = [1, 2, 3] adict = {akey: alist} This code will cause an error due to the reason above.
27th Aug 2016, 2:06 PM
Eduard Hirsch
Eduard Hirsch - avatar
+ 2
"unhashable" means it cannot be used to build hash. Dictionaries use hash-functions to speed up access to values through keys
15th Oct 2016, 7:35 AM
Piter Bunt
Piter Bunt - avatar