-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Introduce _typeshed.Maybe #7870
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
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like getting rid of the comment copy/pasta.
I'm not sure if Maybe
is a good name for this, since it means "could be None and you must check for it" in some other languages, but I don't have better suggestions in mind.
Co-authored-by: Akuli <[email protected]>
True, but it's succinct and has the meaning "could be unset/null/none/undefined" in other languages, so the name at least has some meaning, even if it's not a 100% match to what other languages do. |
We've talked about WeakUnion before, so WeakOptional seems a pretty natural name to me |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
I don't think we should use "optional". That name has caused lots of confusion in the past. Also, it's a fairly long name. |
|
|
We could bikeshed this forever, but I still think |
Indeed we could, but I do think the choice of name is important here -- I'd prefer the status quo over a confusing alias name. Personally, I prefer either |
|
|
I think the name shouldn't be too clever or short. If you see Maybe we should just call this |
I'd be fine with |
No consensus. |
We use the
X | Any
pattern for return types more and more. Introducing a type alias legitimizes the pattern, makes it easier to recognize, easier to grep, and means that we don't need to repeat the documentation.