-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Any option to not allow None as valid member of every type? #875
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
Comments
This is supposed to be an error unless you use |
That's great. Hopefully a dupe with a fix already in the works 👍 Does that mean mypy will get exhaustive checks on unions for free?
Also, will
|
I think you're supposed to use |
@Dedolg: None of those examples are legal under PEP 484, which does not appear to special case You could also do this in a stub (.pyi) file:
Then the No idea how much of this stuff is actually implemented by mypy, though. |
This is a duplicate of #359 and the original issue has additional discussion, though some of it is now out of date. This would be a great thing to have, and I've been looking at this question for a long time -- but we haven't made a ton of progress yet. At least these things are blocking this:
Together this is probably at least a few weeks of work. We could postpone 2 and 3 and initially have a flag to optionally enable explicit Further discussion should be moved to #359 or individual, more specific issues. |
Closing as dupe. |
I think the option of introducing the flag option for |
The flag |
I would like something like this to be an error:
The text was updated successfully, but these errors were encountered: