You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[question] dictionary _KT typevar and hashability #3884
I recently noticed that the _KT typevar used in annotating dict has no upper bound specified, yet dictionary keys must (as far as I'm aware) always be hashable.
Is there a reason here as to why _KT is not defined as TypeVar('_KT', bound=Hashable)?
The Hashable type can't really be typechecked (because all types are hashable by default); see prior discussion in #2148, python/mypy#1746, python/mypy#2455.
Activity
JelleZijlstra commentedon Mar 28, 2020
The
Hashabletype can't really be typechecked (because all types are hashable by default); see prior discussion in #2148, python/mypy#1746, python/mypy#2455.BvB93 commentedon Apr 4, 2020
Thanks for the info!
I'd consider this question answered.
ikonst commentedon Apr 26, 2020
Given that certain types are marked as non-hashable (#3219) wouldn't this have at least a fringe value?
test: Add test that should be a type error
test: Add test that should be a type error
test: Add test that should be a type error
test: Add test that should be a type error