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
mypy 0.981 and 0.982 consider Hashable and None to be overlapping.
I know that technically it is correct, since None is indeed hashable, but the way that None is used in python for default values makes this overlap inconvenient.
I could not find any hint in the changelog that indicates that this has changed.
Like you say, these overloads do overlap, and in fact you likely want to switch the order of them (and then type ignore the overlap lint, mypy will still understand what's going on).
For more type system features, maybe follow python/typing#801. But Hashable is just a tricky type.
Bug Report
mypy 0.981 and 0.982 consider
Hashable
andNone
to be overlapping.I know that technically it is correct, since
None
is indeed hashable, but the way thatNone
is used in python for default values makes this overlap inconvenient.I could not find any hint in the changelog that indicates that this has changed.
To Reproduce
Expected Behavior
Like mypy <= 0.971 no issue here.
Actual Behavior
Other
In case the new behavior is intended, is there a way to specify a "hashable but not None" type?
Your Environment
mypy.ini
(and other config files): show_error_codes = TrueThe text was updated successfully, but these errors were encountered: