-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
==
on collections containing missing
breaks its contract
#52484
Comments
Maybe the docs could be made more explicit and say "all non-missing pairs of values". |
To me, the docstring implies usage of a |
I would expect it to be the same as |
And at least I can assure you that it behaves as intended. ;-)
Actually the reasoning behind the implemented behavior is different. The idea is that
You mean the documentation? Existing code can rely on the implementation, but not on an interpretation of the docstring which doesn't match the actual behavior. |
Then the docstring isn't precise enough in the behavior that is guaranteed, since the docstring is at the very least ambiguous in what is required/guaranteed.
That seems backwards to me - relying on what is documented is what has always been the go-to in Julia ("if it's not in the Manual, it's not API"), so hearing this is directly counter to what has been practiced so far. To me it feels like you're trying to justify the existing behavior post-fact. |
my reading of the existing documentation matches the existing behavior
I would call it at the very most ambiguous? maybe the intersection of those two bounds makes it exactly equal ambiguous. I certainly wouldn't agree that it's worded in a way counter to existing behavior |
If swapping the order in the conditional changes the result (that is, checking for "all non-missing values are equal" first), the documentation is certainly ambiguous. You're reading the docstring like |
The "all non-missing values are equal" clause could actually be read in at least three ways:
Docs do double-duty: they must be both accessible to newcomers while still giving technical guidance to advanced users. |
You can add at least two more, duplicating the last two - |
Right, which is precisely why this isn't well-specified enough to be a "contract" that should force implementation changes counter to the very much intended design. |
So what can I as a user that wants to implement |
Maybe the simplest way to document this would be by mentioning the result of calling
|
What does "pair of values in matching positions" mean for non-orderable collections like
I'd argue that this NOT being |
I think that's intended, because |
Yes, that's (partially) my point - |
Alright, here's my spitball at fixing #52484. This also clarifies the non-missing behaviors, and adds a reference to `all` which should be a useful breadcrumb. I don't want to say `all(x .== y)` because that has all sorts of broadcasting semantics, but we could perhaps add a comparison to `all(splat(==), zip(x, y))` or `all(map(==, x, y))`, but even those feel sketchy to reference as they may miss other properties (like array shape). --------- Co-authored-by: Jameson Nash <vtjnash@gmail.com> Co-authored-by: inky <git@wo-class.cn> Co-authored-by: Max Horn <max@quendi.de>
Yet:
Per the docstring, these should both be
false
, since the non-missing values are not equal.The text was updated successfully, but these errors were encountered: