-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistently mark types with | MaybeNone
whenever it is applicable
#12822
Comments
Feel free to submit a PR! And if you're motivated to get this to a better state, consider writing a PEP for something like python/typing#1096. |
Or python/typing#566, which would replace this with |
Sure, if But that's what I want to track in this issue - that all the occurrences are readily marked for this. So that then it's more straightforward to apply any such ideas. |
This comment was marked as outdated.
This comment was marked as outdated.
@JelleZijlstra Looks like this issue can be closed since the PR: #12855 was merged. |
That PR is only for stdlib, I haven't looked at stubs of third party libraries |
I noticed that there's a special type alias
MaybeNone
that represents this specific intent:You can find an example in a relatively recent addition of this.
And while this approach makes me very sad, it is good that such cases are marked with
MaybeNone
, for the purpose of looking at them specially. Maybe some type checker will arise that will have specific handling for it and do something smarter instead.With that in mind, it would be good to ensure that all such cases are consistently marked.
I noticed at least one case that is not marked like this. It has
| Any
directly written instead of| MaybeNone
. This is inre.match.group*
:typeshed/stdlib/re.pyi
Lines 93 to 117 in 6feca18
The text was updated successfully, but these errors were encountered: