-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
arrays[a, r, r, a, y, s][a, r, r, a, y, s]breakingThis change will break codeThis change will break codehelp wantedIndicates that a maintainer wants help on an issue or pull requestIndicates that a maintainer wants help on an issue or pull request
Milestone
Description
I'm sure this has been discussed elsewhere, but maybe not recently or in a focussed/isolated fashion. If this shouldn't be an issue report, I'll move it to julia-users.
Essentially, I would say this behavior is surprising:
julia> x = reshape(1:3^3, (3,3,3));
julia> size(x)
(3,3,3)
julia> x[3,4]
12
This was a cause of a hard-to-find bug for me recently, where I accidentally forgot an index.
I suppose this is in some way a generalization of the fact that x[12] works, but I'm not really sure why or where that behavior is useful for 2D-or-higher indices. Is there some logic for the current behavior?
EDIT: most similar discussion: #5396
andyferris, ChristianKurz, amckinlay, yha and JLTastet
Metadata
Metadata
Assignees
Labels
arrays[a, r, r, a, y, s][a, r, r, a, y, s]breakingThis change will break codeThis change will break codehelp wantedIndicates that a maintainer wants help on an issue or pull requestIndicates that a maintainer wants help on an issue or pull request