-
Notifications
You must be signed in to change notification settings - Fork 159
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
Fix test for mixed-ness in Function.sub, and fix Cofunction.sub to match #3961
Conversation
|
|
@connorjward @ksagiyam I removed the bounds checking in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM more or less
I'm happy to permit negative indices and do the Pythonic thing. There is no way that this will break user code to change. |
Great, I've updated the test so that it checks a negative index that is actually out of bounds. |
I think those bound checks are there to give clearer error message:
vs.
so I think we should keep them. |
That's the usual python message for bad indices so personally I'm fine with it. If we really want a slightly more detailed one then we should be catching the |
I agree. If we really cared about this we should probably have something like try:
return data[i]
except IndexError as e:
raise FunctionSpaceIndexOutOfBoundsException("...") from e but I don't think it's terribly important. Providing an informative error message is fine. Adding our own bounds checking logic when Python already does the right thing is not. |
I see. I am fine with that. |
Fixes #3933
Cofunction.sub
in line withFunction.sub
.