-
-
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
singledispatch chain gives type errors #3207
Labels
bug
mypy got something wrong
Comments
But there is a workaround that works in almost the same way (for us it's good enough) and typechecks:
|
see #2904 |
Cannot reproduce on 0.920+; this appears to now be fixed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe this is different from other issues about singledispatch (#2904).
This is the program that does not type-check:
Expected output from running it:
running mypy 0.501 with Python 3.5 gives the following errors:
Next is just the motivation part - why do we need this :)
Why such a complicated program: I want both "base" and "a" dispatch to "b", because "base" is a more generic function that works for any type supported by our library, and "a" is less generic, and all functions that dispatch from "a" share a common signature. So the user can import "a" and get more help from the IDE (and mypy) about supported arguments:
Real code that fails to typecheck is here: https://github.com/TeamHG-Memex/eli5/blob/724c63a9b97e44eef8264305e66e808d249810c4/eli5/sklearn/explain_weights.py#L114
The text was updated successfully, but these errors were encountered: