-
-
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
Add docstring for keys(::AbstractArray) #36073
Conversation
This is helpful for users, and it matters because some Base functions rely on `keys(::AbstractArray)` returning a collection of integer ranges (e.g. `hash`).
Are you thinking of |
If I understand what @naliman wants to point that This distinction is relevant for arrays that allow for other indexing except numbers (like NamedArrays.jl) - and the question is if such arrays can return those "other indices" though |
Thanks for the suggestion.That's fine with me too. So
|
Fascinating. I'm not sure anyone has tried doing this yet — and we don't have a well-defined boundary for what needs to be overridden if
That's not quite how hash uses
I'd be inclined to help make this work rather than simply documenting that it doesn't. In fact, NamedArrays might be in good stead for this usage if it provides |
At the same time, |
I only put that in there to assuage the thought that it might return a dense |
Well - not knowing these details we already made
|
Nice, that's great! That's precisely the sort of usage that I think is acceptable (and beyond that, it's great!) and I don't want to document it away. |
@bkamins AFAICT |
Ah - you are right. I was looking at
I will open an issue for this in DataFrames.jl |
I just noticed that BTW, @mbauman, how do attempts to improve the handling of axis names in |
Actually this is what I have also checked today :). I think that the key thing that would be great to have decided is the rule for The issue is that - at least in DataFrames.jl - we found it more convenient for |
So what is the decision here? Just to confirm, so that we can take appropriate steps in DataFrames.jl. Is the contract that |
@mbauman, what's your take? |
Good question.
This is definitely the "safe" thing to do, and maybe it's what we need to demand. I was hoping that we weren't too far from making this possible, but I think it's too tricky to try to officially support at the moment. |
Co-authored-by: Matt Bauman <[email protected]>
This is helpful for users, and it matters because some Base functions may rely on these guarantees for their correct behavior (e.g. `hash`). Co-authored-by: Matt Bauman <[email protected]>
This is helpful for users, and it matters because some Base functions may rely on these guarantees for their correct behavior (e.g. `hash`). Co-authored-by: Matt Bauman <[email protected]>
This is helpful for users, and it matters because some Base functions may rely on these guarantees for their correct behavior (e.g. `hash`). Co-authored-by: Matt Bauman <[email protected]>
This is helpful for users, and it matters because some Base functions rely on
keys(::AbstractArray)
returning a collection of integer ranges (e.g.hash
).Cc: @bkamins