Timeline for answer to How to overcome TypeError: unhashable type: 'list' by All Іѕ Vаиітy
Current License: CC BY-SA 4.0
Post Revisions
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 9, 2021 at 4:17 | comment | added | All Іѕ Vаиітy |
@msh855 You can't hash a list given size 0 or a quadrillion. Its the issue with the types not the size. LIST DOES NOT HAVE A __hash__ METHOD. A work around is create a custom_list type that inherits list with a method __hash__() then convert your list to use the custom_list datatype. still better to use built-in types.
|
|
| Feb 3, 2021 at 1:10 | comment | added | Vers | Thank you for explaining the reason. That cleared my doubt while trying to solve a problem with 2 approaches and both had the type as 'list' but one was giving this error. | |
| Jan 9, 2020 at 17:19 | comment | added | Sreram | @msh855 is there any size limit? I tested the dictionary with a tuple of size 100,000 and it worked fine for me (I'm using python 3.6) | |
| May 15, 2019 at 10:16 | comment | added | msh855 | what if the list is too big ?? looks that is a good solution but not general enough | |
| Nov 12, 2018 at 2:58 | history | edited | All Іѕ Vаиітy | CC BY-SA 4.0 |
added 5 characters in body
|
| Jul 16, 2018 at 10:32 | history | answered | All Іѕ Vаиітy | CC BY-SA 4.0 |