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
We received a similar feature request for pyright. I considered doing a spot fix specifically for __hash__, but this struck me as a bit hacky and not very generalizable, since there are other valid protocols that could also apply to None.
I thought of another approach that might work better. Could we define a NoneType in typing.pyi that defines the methods supported by None? Type checkers could then use this class definition when doing protocol validation. Interested in your thoughts.
If you're open to that approach, I'd be happy to submit a PR to typeshed that defines NoneType.
It sounds reasonable, since the type of None is not available in the builtins or types in Python 3. I don't see a use case for making it available at runtime, however. It was removed from types in Python 3 (types.NoneType exists in Python 2.7), and I'd assume this happened for a reason. So maybe we should be name it _NoneType to make it more clear that it's an internal definition that's only supposed to be used by tools?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8768.