-
-
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
accessing arrays via tuples #6940
Comments
Dup of #6856. That issue also includes a workaround for this. |
Agreed, this isn't a dup, IMO, but perhaps @vgupta1 can clarify. |
@IainNZ is right.. sorry for the confusion. I'd like the return type to be a Vector of Floats of length 3 in both cases. |
Oops! My mistake. Though the ambiguity between the two is probably worth noting. |
I think the conceptual glitch is that tuples act a lot like arrays that you can't change the size of, so its quite unexpected for this to not work. Like, this works, and I tihnk is quite understandable/logical/consistent:
but what @vgupta1 is doing doesn't. |
It seems sensible for me that this should work, but maybe there's some issue I'm not thinking of. Maybe @andreasnoackjensen, @jiahao, @stevengj or @JeffBezanson can think of some problem. |
For Dicts, we've already equated indexing with a tuple with multi-argument indexing. I've always thought it would be nice to generalize linear indexing so that any indexing can be done efficiently with a single index object. Tuples are a natural candidate for n-d array index objects. I do see the potential for confusion though. Comparing to |
For indexing, I think I'd expect tuples to behave like |
I would also find that tuples are a natural representation for a multiindex (i.e. vote for |
Another point is that the kind of indexing done by |
I think that given the ambiguity between whether |
Yes, I think we're going to leave this alone for now. |
Hi All,
This may be by design, but I found it confusing:
Was this intentional please? I may be missing something, but I would have thought it possible to index a vector using any iterable collection. Happy for someone to explain to me what I'm missing.
@IainNZ Thought you'd be interested in response.
The text was updated successfully, but these errors were encountered: