-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Default non-optional function parameter is accepted with a default as None. #9077
Comments
Note: I tried with |
I think you're looking for |
Maybe we should flip the default on |
Yeah, I've been thinking about this. We might want to do it separately from other major breaking changes, such as the switch to a modular typeshed. |
Closing in favor of #9091. Let's continue the discussion there. |
Hi,
Mypy seems to not be bothered by
None
as a default function argument, even if that argument is not anOptional
.Here is an example:
Running mypy on this does not lead to any issue.
mypy version: 0.782
Expected:
I would expect mypy to tell me that
None
is not a valid default value forindex
, because it has typeint
.Instead, the following code should be considered valid:
The text was updated successfully, but these errors were encountered: