Skip to content
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

clarify non-scalar indexed assignment #39788

Merged
merged 3 commits into from
Feb 25, 2021
Merged

clarify non-scalar indexed assignment #39788

merged 3 commits into from
Feb 25, 2021

Conversation

mbauman
Copy link
Sponsor 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
Sponsor 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
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