-
-
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
False positive on numpy.mgrid #11185
Labels
bug
mypy got something wrong
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
The following code triggers a mypy type checking failure:
Mypy reports "Slice index must be an integer or None" on this code snippet.
Admittedly this is a special case, because
numpy.mgrid
does not get "called" with parenthesis but square brackets. But a complex number as the third argument to mgrid is valid code and has a special meaning (it makesmgrid
create an array with this many entries). See also: https://numpy.org/doc/stable/reference/generated/numpy.mgrid.htmlEDIT:
numpy.mgrid
also allows floats for the first two "slices", which also triggers a mypy error:To Reproduce
Type check the above code snippet with mypy.
Expected Behavior
The above code should pass type checking.
Actual Behavior
Mypy reports "Slice index must be an integer or None".
Your Environment
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: