-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
have a single bad index error type? #25005
Comments
I think that |
+1 for IndexError. My first thought was that the existing types make important distinctions, but the more I think about it I can't really back that up. |
Currently we use We use a much larger assortment of types to describe bad index errors more descriptively. Those I could find include: |
Indeed, the problem with unifying them is that for |
Adding or removing (or rearranging) information in the error hierarchy should be largely non-breaking to do later in v1.x. However, implementing custom dispatch via a field of Do we have an issue for the other error types that overlap (and so we had to pick the one that felt "most specific") but might want to formalize? (e.g. #5234, #14273, #24699, #20402) |
I'm inclined to leave this alone for 1.0. Our error types are kind of arbitrary because our error handling is a bit loosey goosey (as is the fashion in dynamic languages), so until we have more structure in error handling in general, it's not going to make that much sense to try to systematize this. |
The counter argument is that adding error types can be done in a non breaking way, while removing them can not. |
We now are using a lot of different error types, rather than unifying them |
We currently have
BoundsError
(not exported),KeyError
(exported) and with #24999StringIndexError
(exported), where I noted that it might be nice to have a single shared exception type for "bad indexing value", whether the thing you're indexing into is an array, a dict or a string.The text was updated successfully, but these errors were encountered: