-
-
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
Equality of empty ranges #29421
Comments
There's likely a historical reason to this: before #16401, arrays and ranges could never be equal, so there was no transitivity issue. We should definitely change that IMHO. |
This is a reasonable change, but it would be at odds with the
|
Yes, that's related to #22354. But I don't think that's a problem here. The result of |
Marking for triage since that would be technically breaking. |
But isn't |
Yes, we can definitely make that case but we still have to consider the consequences. Definitely need discussion in any case. |
Triage generally feels that these should be made |
I generally agree with that but |
I'm a bit hazy on when you would compare the result of searchsorted like that. Can someone thing of realistic example of that kind of usage? |
In interpolation at |
Right, but when would it be a problem that different empty ranges returned by |
It seems like the only way this could be a problem would be if you use |
This is a fairly significant change, so it would be good if we got it done sooner rather than later but it's a bit too late for this to happen in 1.1 at this point. |
Should this be changed as well?
|
I think so. I’m kinda surprised that I never noticed that. |
I would even say that this should be changed and backported to 1.5, since the behavior in 1.5 is now very confusing. I would consider it a bug. |
@sostock I agree, could you open an issue so this can be discussed (or a (possibly draft) PR if you feel like) and not forgotten? |
Yeah, I will open a PR. |
I have opened a PR: #36074 |
In order to be equal, ranges need to have the same first element, last element, and step, even if they are empty. Beside being unintuitive, this also breaks the transitivity of
==
:The text was updated successfully, but these errors were encountered: