Skip to content

clarify non-scalar indexed assignment#39788

Merged
JeffBezanson merged 3 commits intomasterfrom
mbauman-patch-1
Feb 25, 2021
Merged

clarify non-scalar indexed assignment#39788
JeffBezanson merged 3 commits intomasterfrom
mbauman-patch-1

Conversation

@mbauman
Copy link
Copy Markdown
Member

@mbauman mbauman commented Feb 22, 2021

The key isn't that indices select more than one location, it's that they could select more than one element. That is, that they have one or more dimensions.

Ref: #39725

The key isn't that indices select more than one location, it's that they _could_ select more than one element.  That is, that they have one or more dimensions.

Ref: #39725
@mbauman mbauman added the docs This change adds or pertains to documentation label Feb 22, 2021
@mbauman
Copy link
Copy Markdown
Member Author

mbauman commented Feb 22, 2021

Hm, this isn't quite right. It might be a reasonable behavior, but what we really do is just based upon whether any index is an array.

@BioTurboNick
Copy link
Copy Markdown
Contributor

I'd like to suggest improving the error thrown by setindex_shape_check, along with this change:

Current:

throw(ArgumentError("indexed assignment with a single value to many locations is not supported; perhaps use broadcasting `.=` instead?"))

Suggestion:

throw(ArgumentError("indexed assignment with a single value to possibly many locations is not supported; perhaps use broadcasting `.=` instead?"))

@JeffBezanson JeffBezanson merged commit 95a34a9 into master Feb 25, 2021
@JeffBezanson JeffBezanson deleted the mbauman-patch-1 branch February 25, 2021 17:35
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
Ref: JuliaLang#39725

Co-authored-by: Nicholas Bauer <nicholasbauer@outlook.com>
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
Ref: JuliaLang#39725

Co-authored-by: Nicholas Bauer <nicholasbauer@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs This change adds or pertains to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants