[issue41114] "TypeError: unhashable type" could often be more clear

2021-11-15 Thread drakebohan
drakebohan added the comment: The problem is that you can't use a list as the key in a dict, since dict keys need to be immutable. This means that when you try to hash an unhashable object it will result an error. For ex. when you use a list as a key in the dictionary , this cannot be done

[issue41114] "TypeError: unhashable type" could often be more clear

2020-10-13 Thread Samuel Freilich
Samuel Freilich added the comment: python-ideas thread: https://mail.python.org/archives/list/python-id...@python.org/thread/B6OMGYIM47OVGOCZLEY3MEUJDFURJRDV/ The most minimal ideas from that seem to be: 1. Maybe link to the glossary from the error message (if links to documentation in

[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-28 Thread Samuel Freilich
Samuel Freilich added the comment: > I think it's reasonable to discuss the problem on python-ideas rather than on > a bugs issue, when it's not obvious what the right solution is. I did start a thread there. Don't object to that, if that's a better forum for this sort of thing. --

[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-28 Thread Irit Katriel
Irit Katriel added the comment: I think it's reasonable to discuss the problem on python-ideas rather than on a bugs issue, when it's not obvious what the right solution is. -- ___ Python tracker

[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-28 Thread Samuel Freilich
Samuel Freilich added the comment: > 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. This is a derisive and beginner-hostile response

[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: > 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

[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-27 Thread Samuel Freilich
Samuel Freilich added the comment: > The user already knows The example I link to in the initial description appears to be one case where the user does not in fact know. I do think context that this restriction applies to dict key in particular is very relevant. The line could use the same

[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Do you think it would help if the exception was of type UnhashableType That would not add more information. The message already says "unhashable type". Saying it twice doesn't help. -- ___ Python tracker

[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-27 Thread Irit Katriel
Irit Katriel added the comment: Do you think it would help if the exception was of type UnhashableType (subclass of TypeError)? This would give the user a hint that this error is a thing which is worth looking for in the docs and understanding. -- nosy: +iritkatriel

[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: > It would be clearer if the message was something like: > > TypeError: 'dict' can not be used as a set value because > it is an unhashable type. IMO that doesn't help. The trackback already shows the code where the exception occurred. The user

[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-26 Thread Irit Katriel
Change by Irit Katriel : -- components: +Interpreter Core type: behavior -> enhancement ___ Python tracker ___ ___ Python-bugs-list

[issue41114] "TypeError: unhashable type" could often be more clear

2020-06-25 Thread Samuel Freilich
New submission from Samuel Freilich : Currently, if you (for example) put a dict as a value in a set or key in a dict, you get: TypeError: unhashable type: 'dict' I'm pretty sure this wording goes back a long time, but I've noticed that Python beginners tend to find this really confusing.