-
-
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
Improve documentation of sort #27661
Comments
See also #22388 (comment) and the corresponding issue #22382. Edit: the following digresses a bit form the point of this issue, but still. I think we're pretty close to resolving the whole My question would be: can we make some minimal changes right now, so that we can resolve the full issue ( |
Crazy idea: for the whole zoo of sort-related functions deprecate the signature sort(x, by = b, lt = l, rev = r) to a positional argument sort(x, ord(by = b, lt = l, rev = r)) Deprecate sort(x, order = o) to sort(x, o) This avoids (1) the type instability within the sort(x, rev = true) becomes # Backward = Rev(Forward), Forward = Lt(isless)
sort(x, Backward) And make sort(x, lt = my_op, rev = true, by = abs) can be written in a stable way as sort(x, Rev(By(abs, Lt(my_op)))) |
Given the number of open issues for |
Good thoughts but not gonna happen in 0.7/1.0; we're trying to get 0.7-beta out quite soon. |
The observed inconsistency in the OP is due to the fact that the |
My key point was, as noted in the title, that I do not find a clear documentation how different arguments interact (but maybe I missed something in the manual). |
My comment was to help whomever documents this behavior not to invalidate the issue |
Following issue #26741 I have another problem with
sort
when usingorder
argument. Consider the following inconsistency as an example (similar thing is present withlt
):In the first case, following the implementation in ordering.jl, Julia ignores
by
argument in the first case, because it is equal to the default and in the second case it respects it.In general
order
argument is not documented well and it defaults to a non-exported value.I am not sure, given we are in 0.7.0-alpha stage if this should be:
order
argument in public API)or
lt
,by
andrev
ororder
keyword argument)?The text was updated successfully, but these errors were encountered: