Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
confusion with hashable
#2
these are 2 different errors
the first one - TypeError: unhashable type: 'set' - you get because elements of a set MUST be hashable.
the second error - TypeError: 'set' object is not subscriptable - you have a dict where values are set. You try to access element of such set (the value for key 'cars') by index - that is not possible. sets are not subscriptable (i.e. you cannot use [] to access element), they are unordered collection

the list of list example does not raise any error - it's perfectly fine to have unhashable element in a list
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
confusion with hashable - by spalisetty06 - Aug-20-2020, 02:41 PM
RE: confusion with hashable - by buran - Aug-20-2020, 02:46 PM
RE: confusion with hashable - by spalisetty06 - Aug-20-2020, 03:40 PM
RE: confusion with hashable - by spalisetty06 - Aug-21-2020, 01:11 PM
RE: confusion with hashable - by ndc85430 - Aug-21-2020, 02:27 PM
RE: confusion with hashable - by deanhystad - Aug-21-2020, 07:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  hashable confusion spalisetty06 3 2,030 Aug-16-2020, 03:54 PM
Last Post: spalisetty06

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020