Skip to content

Conversation

@mcabbott
Copy link
Contributor

@mcabbott mcabbott changed the title See axes axes from eachindex's docstring, etc. See also axes from eachindex's docstring, etc. May 18, 2022
@DilumAluthge DilumAluthge requested review from c42f and simeonschaub May 18, 2022 16:12
iterable object that is fast for all arguments (a [`UnitRange`](@ref)
if all inputs have fast linear indexing, a [`CartesianIndices`](@ref)
otherwise).
If the arrays have different sizes and/or dimensionalities, a `DimensionMismatch` exception
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside, I'm not sure what "and/or" means, but I don't think this describes the actual behaviour:

julia> eachindex([1,2,3], [1 2 3])  # size (3,) and (1, 3) accepted
Base.OneTo(3)

julia> eachindex([1,2,3], [1 2 3]')  # size (3,) and (3,1) not accepted here
ERROR: DimensionMismatch: all inputs to eachindex must have the same axes

julia> eachindex([1,2,3], [1;2;3;;])  # size (3,) and (3,1) now accepted, as both prefer linear indexing?
Base.OneTo(3)

julia> eachindex([1;2;3;;], [1 2 3]')  # both size (3,1), but different eachindex
CartesianIndices((3, 1))

Is this what's intended? And how should it then be described?

Copy link
Member

@c42f c42f May 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In English "or" often means xor, so "and/or" disambiguates that case. It's a bit awkward.
https://en.wikipedia.org/wiki/And/or

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, although it still seems an odd choice to describe computer logic, not a menu. And if differing dimensionalities means ndims, that implies differing size anyway.

While differing size might be necessary for an error, it's not sufficient. Can we describe the actual behaviour accurately? Or are some of those bugs?

@oscardssmith oscardssmith added the docs This change adds or pertains to documentation label May 18, 2022
Copy link
Member

@c42f c42f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@mcabbott
Copy link
Contributor Author

Can this be merged?

@mcabbott
Copy link
Contributor Author

Bump?

@oscardssmith oscardssmith merged commit baa85f4 into JuliaLang:master Aug 22, 2022
@mcabbott mcabbott deleted the doc7 branch August 22, 2022 15:51
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