This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients iritkatriel, rhettinger, sfreilich
Date 2020-09-28.04:22:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601266965.66.0.528373360415.issue41114@roundup.psfhosted.org>
In-reply-to
Content
> I've noticed that Python beginners tend to find this really confusing.

No minor tweak to the exception message will make this go away.  For understanding to occur, the only way to forward is to learn a bit about hashability.  That is a step that every beginner must take.

Fortunately, the term "hashable" is listed in the glossary.  Also the error message itself is easily Googled:

   https://docs.python.org/3/glossary.html#term-hashable

   https://www.google.com/search?q=TypeError%3A+unhashable+type%3A+%27dict%27&oq=TypeError%3A+unhashable+type%3A+%27dict%27

I suggest that you take this to the python-ideas list.  While there is a valid concern that a new user may not understand the error message (this is unfortunately true for many our error messages), the proposals don't actually improve the situation.

The first proposal adds hard-to-implement context information that still doesn't tell a user what the issue is.  The second proposal repeats information that is already being shown.  Neither proposal explains what is meant by unhashable type, why it matters, what would be an allowable hashable type, or how to fix the problem (which is what the user really wants to know).

After a discussion on python-ideas, if a better proposal is found, feel free to reopen this issue.
History
Date User Action Args
2020-09-28 04:22:45rhettingersetrecipients: + rhettinger, sfreilich, iritkatriel
2020-09-28 04:22:45rhettingersetmessageid: <1601266965.66.0.528373360415.issue41114@roundup.psfhosted.org>
2020-09-28 04:22:45rhettingerlinkissue41114 messages
2020-09-28 04:22:44rhettingercreate