-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Should Mypy warn about potential invalid arguments to max
?
#4051
Comments
This is more of a typeshed issue. Currently |
Hello, today I sketched a solution for this. I wrote my own clone of https://gist.github.com/ramalho/1ed164b65ec8c36716ca9c90780890b8 |
@ramalho That looks about right! A couple of the overloads (1 and 2 for example) can be merged by putting |
Thanks, @JelleZijlstra! You are right, I was able to merge 3 overloads, now down to 6: https://gist.github.com/ramalho/1ed164b65ec8c36716ca9c90780890b8 It occurred to me that the So my plan is to send a PR for the Would you prefer that I file a bug about |
Thanks! No need to file an issue. I feel like there's some chance narrowing the types of |
I am working on this. Instead of
First PR will touch |
Fantastic, thanks. I'll never make that silly error again. 👍 |
I was surprised that Mypy didn't flag an issue where I was calling
max
with an int and a None, which throws a TypeError at runtime.For example, in the following code, should I not expect Mypy to warn that
top
is potentially None, which wouldn't work withmax
?The text was updated successfully, but these errors were encountered: