Python Forum
Creating a set with dataclass and dict
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a set with dataclass and dict
#11
Ok I finally understand. The hashable test got me here, I was too confident in his result. I didn't check the documentation about it.

So the response is that a set need a Hashable object, and an object that contain a mutable object is not Hashable, hence the error.

Thank you all for your help, you were kind. Gave reputation, and closing the subject.
Have a nice day.
Hobbit
Reply
#12
maybe confusuion came from hashable - i.e. in the sense that when you pass object to hash() function it will not raise error, not that it is instance of collections.abc.Hashable
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


Possibly Related Threads…
Thread Author Replies Views Last Post
  append str to list in dataclass flash77 6 343 Mar-14-2024, 06:26 PM
Last Post: flash77
  Sort a dict in dict cherry_cherry 4 62,538 Apr-08-2020, 12:25 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

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